1000
|
It is possible to search for an item ( inside the Editor ), case insensitive
![](images/exgridq1000.png)
With AxGrid1
.BeginUpdate()
With .Columns.Add("DropDownList").Editor
.EditType = EXGRIDLib.EditTypeEnum.DropDownListType
.AddItem(1,"One")
.AddItem(2,"Two")
.AddItem(3,"Three")
End With
With .Items
.AddItem(AxGrid1.Columns.Item(0).Editor.FindItem(">ONE"))
.AddItem(AxGrid1.Columns.Item(0).Editor.FindItem(">ThRee"))
.AddItem(AxGrid1.Columns.Item(0).Editor.FindItem("ONE"))
.AddItem(AxGrid1.Columns.Item(0).Editor.FindItem(">tWo"))
End With
.EndUpdate()
End With
|
999
|
The text after the BR-tag is in same line as the text before the BR-tag (entire column)
![](images/exgridq999.png)
With AxGrid1
.BeginUpdate()
.DrawGridLines = EXGRIDLib.GridLinesEnum.exHLines
With .Columns.Add("Default")
.Def(EXGRIDLib.DefColumnEnum.exCellValueFormat) = 1
.Def(EXGRIDLib.DefColumnEnum.exCellSingleLine) = False
End With
With .Items
.AddItem("This is the first line.<br>This is the second line.")
.AddItem("This is the first line.<br>This is the second line.")
.AddItem("This is the first line.<br>This is the second line.")
End With
.EndUpdate()
End With
|
998
|
The text after the BR-tag is in same line as the text before the BR-tag (individual)
![](images/exgridq998.png)
Dim h
With AxGrid1
.BeginUpdate()
.DrawGridLines = EXGRIDLib.GridLinesEnum.exHLines
.Columns.Add("Default")
With .Items
.CellValueFormat(.AddItem("This is the first line.<br>This is the second line."),0) = EXGRIDLib.ValueFormatEnum.exHTML
h = .AddItem("<b>This is the first line.<br>This is the second line.</b>")
.CellValueFormat(h,0) = EXGRIDLib.ValueFormatEnum.exHTML
.CellSingleLine(h,0) = EXGRIDLib.CellSingleLineEnum.exCaptionWordWrap
.CellValueFormat(.AddItem("This is the first line.<br>This is the second line."),0) = EXGRIDLib.ValueFormatEnum.exHTML
End With
.EndUpdate()
End With
|
997
|
Can I disable an item once the user selects a new value into a different item
![](images/exgridq997.png)
' Change event - Occurs when the user changes the cell's content.
Private Sub AxGrid1_Change(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_ChangeEvent) Handles AxGrid1.Change
With AxGrid1
With .Items
.EnableItem(.ItemByIndex(1)) = False
End With
End With
End Sub
Dim h1,h2
With AxGrid1
.FreezeEvents(True)
.BeginUpdate()
.ScrollBySingleLine = True
.DrawGridLines = EXGRIDLib.GridLinesEnum.exRowLines
.Columns.Add("Q")
.Columns.Add("A")
With .Items
h1 = .AddItem("What's your gender?")
With .CellEditor(h1,1)
.EditType = EXGRIDLib.EditTypeEnum.DropDownListType
.AddItem(1,"Male")
.AddItem(0,"Female")
End With
.CellValue(h1,1) = 1
h2 = .AddItem("What's pet name?")
.CellValue(h2,1) = "This is my pet favorite long long long name, that shoul break the line in multiple pieces"
.CellSingleLine(h2,1) = EXGRIDLib.CellSingleLineEnum.exCaptionWordWrap
End With
.EndUpdate()
.FreezeEvents(False)
End With
|
996
|
How can I get a row expanded / enlarged to fit the cell's text (entire column)
![](images/exgridq996.png)
Dim h1,h2
With AxGrid1
.BeginUpdate()
.ScrollBySingleLine = True
.DrawGridLines = EXGRIDLib.GridLinesEnum.exRowLines
.Columns.Add("Q")
With .Columns.Add("A")
.Def(EXGRIDLib.DefColumnEnum.exCellSingleLine) = False
With .Editor
.EditType = EXGRIDLib.EditTypeEnum.MemoType
.Appearance = EXGRIDLib.InplaceAppearanceEnum.SingleApp
End With
End With
With .Items
h1 = .AddItem("What's name?")
.CellValue(h1,1) = "This is my pet favorite long long long name, that shoul break the line in multiple pieces"
h2 = .AddItem("What's your pet name?")
.CellValue(h2,1) = "This is my pet favorite long long long name, that shoul break the line in multiple pieces"
End With
.EndUpdate()
End With
|
995
|
How can I get a row expanded / enlarged to fit the cell's text (individual cell)
![](images/exgridq995.png)
Dim h1,h2
With AxGrid1
.BeginUpdate()
.ScrollBySingleLine = True
.DrawGridLines = EXGRIDLib.GridLinesEnum.exRowLines
.Columns.Add("Q")
.Columns.Add("A")
With .Items
h1 = .AddItem("What's name?")
.CellValue(h1,1) = "This is my pet favorite long long long name, that shoul break the line in multiple pieces"
h2 = .AddItem("What's your pet name?")
With .CellEditor(h2,1)
.EditType = EXGRIDLib.EditTypeEnum.MemoType
.Appearance = EXGRIDLib.InplaceAppearanceEnum.SingleApp
End With
.CellValue(h2,1) = "This is my pet favorite long long long name, that shoul break the line in multiple pieces"
.CellSingleLine(h2,1) = EXGRIDLib.CellSingleLineEnum.exCaptionWordWrap
End With
.EndUpdate()
End With
|
994
|
InsertControlItem / UserEditor / A2X:
![](images/exgridq994.png)
Dim h,hX
With AxGrid1
.BeginUpdate()
.BackColor = RGB(240,240,240)
.ConditionalFormats.Add("1 = 1").Bold = True
.Columns.Add("Type").Alignment = EXGRIDLib.AlignmentEnum.RightAlignment
With .Items
h = .AddItem("1. A ProgID such as ""MSCAL.Calendar.7""")
.ItemDivider(h) = 0
hX = .InsertControlItem(0,"MSCAL.Calendar","")
.ItemObject(hX).BackColor = RGB(255,255,255)
h = .AddItem("2. A CLSID such as ""{0036F83C-D892-4B7B-AA0B-BEDD8D16A738}""")
.ItemDivider(h) = 0
hX = .InsertControlItem(0,"{0036F83C-D892-4B7B-AA0B-BEDD8D16A738}","")
h = .AddItem("3. A URL such as ""http://www.exontrol.com""")
.ItemDivider(h) = 0
hX = .InsertControlItem(0,"http://www.exontrol.com","")
h = .AddItem("4. A reference to an Active document such as ""file://\\Documents\MyDoc.doc""")
.ItemDivider(h) = 0
hX = .InsertControlItem(0,"file://C:\empesting.xml","")
h = .AddItem("5.A fragment of HTML such as ""MSHTML:<HTML><BODY>This is a line of text</BODY></HTML>""")
.ItemDivider(h) = 0
hX = .InsertControlItem(0,"MSHTML:<HTML><BODY>This is a <b>line of</b> text</BODY></HTML>","")
.ItemHeight(hX) = 56
h = .AddItem("6.Anything, if it is preffixed by ""A2X:""")
.ItemDivider(h) = 0
hX = .InsertControlItem(0,"A2X:TOC24.Toc24Ctrl.1","")
End With
.EndUpdate()
End With
|
993
|
How do I add a RichTextBox editor
' UserEditorOleEvent event - Occurs when an user editor fires an event.
Private Sub AxGrid1_UserEditorOleEvent(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_UserEditorOleEventEvent) Handles AxGrid1.UserEditorOleEvent
With AxGrid1
Debug.Print( e.ev )
End With
End Sub
With AxGrid1
.BeginUpdate()
.DrawGridLines = EXGRIDLib.GridLinesEnum.exAllLines
.DefaultItemHeight = 32
With .Columns.Add("RICHTEXT").Editor
.EditType = EXGRIDLib.EditTypeEnum.UserEditorType
.UserEditor("RICHTEXT.RichtextCtrl","")
With .UserEditorObject
.AutoVerbMenu = True
.TextRTF = "{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard\r\nThis is some {\b bold} text.\par\r\n}"
End With
End With
With .Items
.AddItem("RICHTEXT.RichtextCtrl")
End With
.EndUpdate()
End With
|
992
|
Is it possible to trap a double-click event on a specific cell and when that happens, to set the cell to a specific value
' DblClick event - Occurs when the user dblclk the left mouse button over an object.
Private Sub AxGrid1_DblClick(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_DblClickEvent) Handles AxGrid1.DblClick
Dim c,h,hit
With AxGrid1
h = .get_ItemFromPoint(-1,-1,c,hit)
Debug.Print( .Items.CellValue(h,c) )
End With
End Sub
With AxGrid1
.BeginUpdate()
.HeaderAppearance = EXGRIDLib.AppearanceEnum.Etched
.DrawGridLines = EXGRIDLib.GridLinesEnum.exRowLines
.Columns.Add("C1")
.Columns.Add("C2")
With .Items
.CellValue(.AddItem("Item 1"),1) = "Item 2"
.CellValue(.AddItem("Item 3"),1) = "Item 4"
.CellValue(.AddItem("Item 5"),1) = "Item 6"
End With
.EndUpdate()
End With
|
991
|
How can I display dates in DD/MM/YYYY format
![](images/exgridq991.png)
Dim h
With AxGrid1
.BeginUpdate()
.ScrollBySingleLine = False
.Columns.Add("Date")
With .Items
.ItemDivider(.AddItem("Different Date Formats")) = 0
.FormatCell(.AddItem(#12/1/1971#),0) = "((shortdateF(value) mid 4) left 2) + `/` + (shortdateF (value) left 2) + `/` + (shortdateF (value) right 4)"
.FormatCell(.AddItem(#12/1/1971#),0) = "(1 array (0:=(shortdateF(value) split `/`))) + `/` + (0 array (=:0) ) + `/` + (2 array (=:0) )"
.FormatCell(.AddItem(#12/1/1971#),0) = "((`0` + day(value) ) right 2) + `/` + ((`0` + month(value) ) right 2) + `/` + year(value)"
.FormatCell(.AddItem(#12/1/1971#),0) = "day(value) + `/` + month(value) + `/` + year(value)"
.FormatCell(.AddItem(#12/1/1971#),0) = "year(value) + ` - ` + day(value) + ` - ` + month(value)"
h = .AddItem(#12/1/1971#)
.ItemHeight(h) = 24
.CellValueFormat(h,0) = EXGRIDLib.ValueFormatEnum.exHTML
.FormatCell(h,0) = "`<b>` + year(value) + `</b><off -4> ` + day(value) + ` - ` + month(value)"
.ItemDivider(.AddItem("Predefined Date Formats")) = 0
.FormatCell(.AddItem(#12/1/1971#),0) = "value"
.FormatCell(.AddItem(#12/1/1971#),0) = "shortdateF(value)"
.FormatCell(.AddItem(#12/1/1971#),0) = "shortdate(value)"
.FormatCell(.AddItem(#12/1/1971#),0) = "longdate(value)"
End With
.EndUpdate()
End With
|
990
|
I have noticed that the column gets resized once I release the mouse. I have a column that displays multiple-lines cells, and the text gets wrapped only when user releases the mouse. Is it possible to get resized contiguously as I had before
With AxGrid1
.BeginUpdate()
.ScrollBySingleLine = False
.DrawGridLines = EXGRIDLib.GridLinesEnum.exVLines
.ColumnsAllowSizing = True
.Columns.Add("Column A (cont)").Def(EXGRIDLib.DefColumnEnum.exColumnResizeContiguously) = True
.Columns.Add("Column 1")
.Columns.Add("Column B (cont)").Def(EXGRIDLib.DefColumnEnum.exColumnResizeContiguously) = True
.Columns.Add("Column 2")
.EndUpdate()
End With
|
989
|
How do I get the column from cursor, when it hovers the empty portion of the items section
' MouseMove event - Occurs when the user moves the mouse.
Private Sub AxGrid1_MouseMoveEvent(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_MouseMoveEvent) Handles AxGrid1.MouseMoveEvent
Dim c,hit,i
With AxGrid1
i = .get_ItemFromPoint(0,-1,c,hit)
Debug.Print( "Column" )
Debug.Print( c )
End With
End Sub
With AxGrid1
.BeginUpdate()
.DrawGridLines = EXGRIDLib.GridLinesEnum.exVLines
.Columns.Add("Column 0")
.Columns.Add("Column 1")
.Columns.Add("Column 2")
.EndUpdate()
End With
|
988
|
How do I add items once the user clicks the empty area
' Click event - Occurs when the user presses and then releases the left mouse button over the grid control.
Private Sub AxGrid1_ClickEvent(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxGrid1.ClickEvent
Dim c,hit,i
With AxGrid1
i = .get_ItemFromPoint(0,-1,c,hit)
With .Items
.CellValue(.AddItem(i),1) = c
End With
End With
End Sub
With AxGrid1
.BeginUpdate()
.Columns.Add("Number of Items to Add")
.Columns.Add("Click on Column")
.EndUpdate()
End With
|
987
|
Is there any option to stop events
' AddItem event - Occurs after a new Item has been inserted to Items collection.
Private Sub AxGrid1_AddItem(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_AddItemEvent) Handles AxGrid1.AddItem
With AxGrid1
Debug.Print( "AddItem event is fired only if FreezeEvents(False) is called" )
End With
End Sub
Dim h1,h2
With AxGrid1
.FreezeEvents(True)
.BeginUpdate()
.DefaultItemHeight = 24
.Columns.Add("Task")
With .Items
h1 = .AddItem("Task 1")
h2 = .AddItem("Task 2")
End With
.EndUpdate()
.FreezeEvents(False)
End With
|
986
|
How can I include the child items, when a filter is applied
![](images/exgridq986.png)
Dim h0
With AxGrid1
.BeginUpdate()
.ColumnAutoResize = True
.ContinueColumnScroll = False
.MarkSearchColumn = False
.SearchColumnIndex = 1
.Indent = 16
.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exLinesAtRoot
.FilterBarPromptVisible = EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible
.FilterBarPromptPattern = "Nancy"
.FilterInclude = EXGRIDLib.FilterIncludeEnum.exItemsWithChilds
With .Columns
.Add("Name").Width = 96
.Add("Title").Width = 96
.Add("City")
End With
With .Items
h0 = .AddItem("Nancy Davolio")
.CellValue(h0,1) = "Sales Representative"
.CellValue(h0,2) = "Seattle"
h0 = .InsertItem(h0,Nothing,"Andrew Fuller")
.CellValue(h0,1) = "Vice President, Sales"
.CellValue(h0,2) = "Tacoma"
h0 = .InsertItem(h0,Nothing,"Michael Suyama")
.CellValue(h0,1) = "Sales Representative"
.CellValue(h0,2) = "London"
h0 = .AddItem("Janet Leverling")
.CellValue(h0,1) = "Sales Representative"
.CellValue(h0,2) = "Kirkland"
h0 = .InsertItem(h0,Nothing,"Margaret Peacock")
.CellValue(h0,1) = "Sales Representative"
.CellValue(h0,2) = "Redmond"
.ExpandItem(0) = True
End With
.ApplyFilter()
.EndUpdate()
End With
|
985
|
How do I prevent changing the cell's state ( check-box state )
' CellStateChanging event - Fired before cell's state is about to be changed.
Private Sub AxGrid1_CellStateChanging(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_CellStateChangingEvent) Handles AxGrid1.CellStateChanging
With AxGrid1
With .Items
e.newState = .CellState(e.item,e.colIndex)
End With
End With
End Sub
Dim h
With AxGrid1
.BeginUpdate()
.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exLinesAtRoot
With .Columns.Add("P1")
.Def(EXGRIDLib.DefColumnEnum.exCellHasCheckBox) = True
.PartialCheck = True
End With
With .Columns.Add("P2")
.Def(EXGRIDLib.DefColumnEnum.exCellHasCheckBox) = True
.PartialCheck = True
End With
With .Items
h = .AddItem("Root")
.InsertItem(h,Nothing,"Child 1")
.InsertItem(h,Nothing,"Child 2")
.ExpandItem(h) = True
End With
.EndUpdate()
End With
|
984
|
How do I get sorted the column as string, numeric, date, date and time. Also how can it be applied to drop down filter panel
![](images/exgridq984.png)
Dim h
With AxGrid1
.BeginUpdate()
With .Columns.Add("Date")
.SortType = EXGRIDLib.SortTypeEnum.SortDate
.DisplayFilterButton = True
.DisplayFilterPattern = False
.DisplayFilterDate = True
.FilterList = EXGRIDLib.FilterListEnum.exShowFocusItem Or EXGRIDLib.FilterListEnum.exShowCheckBox Or EXGRIDLib.FilterListEnum.exSortItemsDesc
End With
With .Columns.Add("DateTime")
.SortType = EXGRIDLib.SortTypeEnum.SortDateTime
.DisplayFilterButton = True
.DisplayFilterPattern = False
.FilterList = EXGRIDLib.FilterListEnum.exShowFocusItem Or EXGRIDLib.FilterListEnum.exShowCheckBox Or EXGRIDLib.FilterListEnum.exSortItemsDesc
End With
With .Columns.Add("Time")
.SortType = EXGRIDLib.SortTypeEnum.SortTime
.DisplayFilterButton = True
.DisplayFilterPattern = False
.FilterList = EXGRIDLib.FilterListEnum.exShowFocusItem Or EXGRIDLib.FilterListEnum.exShowCheckBox Or EXGRIDLib.FilterListEnum.exSortItemsDesc
.FormatColumn = "time(value)"
End With
With .Columns.Add("Numeric")
.SortType = EXGRIDLib.SortTypeEnum.SortNumeric
.DisplayFilterButton = True
.FilterList = EXGRIDLib.FilterListEnum.exShowFocusItem Or EXGRIDLib.FilterListEnum.exShowCheckBox Or EXGRIDLib.FilterListEnum.exSortItemsDesc
End With
With .Columns.Add("String")
.DisplayFilterButton = True
.FilterList = EXGRIDLib.FilterListEnum.exShowFocusItem Or EXGRIDLib.FilterListEnum.exShowCheckBox Or EXGRIDLib.FilterListEnum.exSortItemsDesc
End With
With .Items
h = .AddItem(#1/27/2010#)
.CellValue(h,1) = #1/27/2010 10:00:00 AM#
.CellValue(h,2) = .CellValue(h,1)
.CellValue(h,3) = 1
.CellValue(h,4) = .CellValue(h,3)
h = .AddItem(#1/27/2011#)
.CellValue(h,1) = #1/27/2011 9:00:00 AM#
.CellValue(h,2) = .CellValue(h,1)
.CellValue(h,3) = 11
.CellValue(h,4) = .CellValue(h,3)
h = .AddItem(#11/2/2010#)
.CellValue(h,1) = #11/2/2010 9:00:00 AM#
.CellValue(h,2) = .CellValue(h,1)
.CellValue(h,3) = 2
.CellValue(h,4) = .CellValue(h,3)
End With
.Columns.Item("DateTime").DisplayFilterDate = False
.EndUpdate()
End With
|
983
|
I am using Layout property to sort multiple columns at once. The problem is that all items get expanded. How do I prevent that
![](images/exgridq983.png)
Dim h
With AxGrid1
.BeginUpdate()
.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exLinesAtRoot
With .Columns.Add("P1")
.Def(EXGRIDLib.DefColumnEnum.exCellHasCheckBox) = True
.PartialCheck = True
End With
With .Columns.Add("P2")
.Def(EXGRIDLib.DefColumnEnum.exCellHasCheckBox) = True
.PartialCheck = True
.FormatColumn = "1 index ``"
End With
With .Items
h = .AddItem("Root")
.InsertItem(h,Nothing,"Child A")
.InsertItem(h,Nothing,"Child B")
.InsertItem(h,Nothing,"Child A")
.InsertItem(h,Nothing,"Child B")
.AddItem("Root")
.AddItem("Root")
End With
.SingleSort = False
.Layout = "multiplesort=""C0:1 C1:2"";collapse="""""
.EndUpdate()
End With
|
982
|
How do I find the cell's type, or what the cell holds
![](images/exgridq982.png)
With AxGrid1
.BeginUpdate()
.DrawGridLines = EXGRIDLib.GridLinesEnum.exRowLines
With .Columns
.Add("Value").Width = 24
.Add("Type").FormatColumn = "type(%0)"
.Add("TypeAsString").FormatColumn = "(0 := type(%0)) array (`empty`, `null`, `short`, `long`, `float`, `double`, `currency`, `date`, `string`, `object`, `error`, `b" & _
"oolean`, `variant`, `any`, `reserved`, `decimal`, `char`, `byte`, `unsigned short`, `unsigned long`, `long on 64 bits`)"
.Add("Length").FormatColumn = "len(%0)"
End With
With .Items
.AddItem()
.AddItem("")
.CellValue(.AddItem(),0) = AxGrid1.GetOcx()
.CellValue(.AddItem(),0) = True
.CellValue(.AddItem(),0) = -1
.CellValue(.AddItem(),0) = -1
.CellValue(.AddItem(),0) = #1/1/2001#
End With
.EndUpdate()
End With
|
981
|
How can I get ride / hide the image being dragged by OLE Drag and Drop
' OLEStartDrag event - Occurs when the OLEDrag method is called.
Private Sub AxGrid1_OLEStartDrag(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_OLEStartDragEvent) Handles AxGrid1.OLEStartDrag
' Data.SetData("data to drag")
With AxGrid1
e.allowedEffects = 1
End With
End Sub
Dim h
With AxGrid1
.OLEDropMode = EXGRIDLib.exOLEDropModeEnum.exOLEDropManual
.set_Background(EXGRIDLib.BackgroundPartEnum.exDragDropAfter,16777215)
.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exLinesAtRoot
.Columns.Add("Default")
With .Items
h = .AddItem("Root")
.InsertItem(h,Nothing,"Child 1")
.InsertItem(h,Nothing,"Child 2")
.ExpandItem(h) = True
End With
End With
|
980
|
The ReadOnly property does not prevent changing the column's check-box (sample 2)
![](images/exgridq980.png)
With AxGrid1
.BeginUpdate()
.ShowFocusRect = False
With .Columns.Add("C1")
.AllowSizing = False
.Width = 18
.Editor.EditType = EXGRIDLib.EditTypeEnum.CheckValueType
End With
.Columns.Add("C2")
With .Items
.CellValue(.AddItem(0),1) = "Item 1"
.CellValue(.AddItem(-1),1) = "Item 2"
.CellValue(.AddItem(0),1) = "Item 3"
End With
.ReadOnly = EXGRIDLib.ReadOnlyEnum.exReadOnly
.Columns.Item(0).Editor.Option(EXGRIDLib.EditorOptionEnum.exCheckValue2) = 2
.EndUpdate()
End With
|
979
|
The ReadOnly property does not prevent changing the column's check-box (sample 1)
![](images/exgridq979.png)
With AxGrid1
.BeginUpdate()
.ShowFocusRect = False
With .Columns.Add("C1")
.AllowSizing = False
.Width = 18
With .Editor
.EditType = EXGRIDLib.EditTypeEnum.CheckValueType
.Option(EXGRIDLib.EditorOptionEnum.exCheckValue2) = 1
End With
End With
.Columns.Add("C2")
With .Items
.CellValue(.AddItem(0),1) = "Item 1"
.CellValue(.AddItem(-1),1) = "Item 2"
.CellValue(.AddItem(0),1) = "Item 3"
End With
.ReadOnly = EXGRIDLib.ReadOnlyEnum.exReadOnly
.EndUpdate()
End With
|
978
|
How can I export checked items only
![](images/exgridq978.png)
With AxGrid1
.BeginUpdate()
With .Columns
.Add("C1").Def(EXGRIDLib.DefColumnEnum.exCellHasCheckBox) = True
.Add("C2").FormatColumn = "1 index `A-Z`"
.Add("C3").FormatColumn = "100 index ``"
End With
With .Items
.AddItem("Item 1")
.CellState(.AddItem("Item 2")) = 1
.CellState(.AddItem("Item 3")) = 1
End With
.EndUpdate()
Debug.Print( "Export CSV Checked Items Only:" )
Debug.Print( .Export("","chk") )
End With
|
977
|
How can I export a hidden column
![](images/exgridq977.png)
With AxGrid1
.BeginUpdate()
With .Columns
.Add("C1")
With .Add("C2")
.FormatColumn = "1 index `A-Z`"
.Visible = False
End With
With .Add("C3")
.FormatColumn = "100 index ``"
.Visible = False
End With
End With
With .Items
.AddItem("Item 1")
.AddItem("Item 2")
.AddItem("Item 3")
End With
.EndUpdate()
Debug.Print( "Export CSV Hidden Columns (1,2):" )
Debug.Print( .Export("","|1,2") )
End With
|
976
|
I'm trying to use automatic numbering of the outline. How can I have A, B, C for root items, 1, 2, 3 for the sub-items, and a, b, c for sub-sub-items (sample 3)
![](images/exgridq976.png)
Dim h,hChild
With AxGrid1
.BeginUpdate()
.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exLinesAtRoot
.DrawGridLines = EXGRIDLib.GridLinesEnum.exRowLines
.AutoDrag = EXGRIDLib.AutoDragEnum.exAutoDragPositionAny
.HasLines = EXGRIDLib.HierarchyLineEnum.exSolidLine
.Indent = 16
.MarkSearchColumn = False
With .Columns
With .Add("")
.Def(EXGRIDLib.DefColumnEnum.exCellValueFormat) = 1
.FormatColumn = "((1:=(0 :=(1 rpos '.|A-Z||a-z|')) rfind `.`) < 0 ? `<b>` + =:0 + `` : (=:0 mid (1 + 1 + =:1) ) + `)` ) + ` ` + value"
End With
End With
With .Items
h = .AddItem("Root")
.InsertItem(h,Nothing,"Child")
hChild = .InsertItem(h,Nothing,"Child")
.InsertItem(hChild,Nothing,"Child")
.InsertItem(hChild,Nothing,"Child")
.InsertItem(hChild,Nothing,"Child")
.InsertItem(h,Nothing,"Child")
.ExpandItem(0) = True
h = .AddItem("Root")
.InsertItem(h,Nothing,"Child")
hChild = .InsertItem(h,Nothing,"Child")
.CellState(hChild,0) = 1
.InsertItem(hChild,Nothing,"Child")
.InsertItem(hChild,Nothing,"Child")
.InsertItem(hChild,Nothing,"Child")
.InsertItem(h,Nothing,"Child")
End With
.EndUpdate()
End With
|
975
|
I'm trying to use automatic numbering of the outline. How can I have A, B, C for root items, 1, 2, 3 for the sub-items, and a, b, c for sub-sub-items (sample 2)
![](images/exgridq975.png)
Dim h,hChild
With AxGrid1
.BeginUpdate()
.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exLinesAtRoot
.GridLineColor = RGB(190,190,190)
.DrawGridLines = EXGRIDLib.GridLinesEnum.exRowLines
.AutoDrag = EXGRIDLib.AutoDragEnum.exAutoDragPositionAny
.HasLines = EXGRIDLib.HierarchyLineEnum.exSolidLine
.Indent = 16
With .Columns
.Add("Default")
With .Add("")
.Def(EXGRIDLib.DefColumnEnum.exCellValueFormat) = 1
.Def(EXGRIDLib.DefColumnEnum.exCellPaddingRight) = 4
.AllowSizing = False
.Width = 36
.Position = 0
.FormatColumn = "(1:=(0 :=(1 rpos '.|A-Z||a-z|')) rfind `.`) < 0 ? `<b>` + =:0 : (`............` left 2 * (=:0 count `.`)) + (=:0 mid (1 + 1 + =" & _
":1) ) "
End With
End With
With .Items
h = .AddItem("Root")
.InsertItem(h,Nothing,"Child")
hChild = .InsertItem(h,Nothing,"Child")
.InsertItem(hChild,Nothing,"Child")
.InsertItem(hChild,Nothing,"Child")
.InsertItem(hChild,Nothing,"Child")
.InsertItem(h,Nothing,"Child")
.ExpandItem(0) = True
h = .AddItem("Root")
.InsertItem(h,Nothing,"Child")
hChild = .InsertItem(h,Nothing,"Child")
.CellState(hChild,0) = 1
.InsertItem(hChild,Nothing,"Child")
.InsertItem(hChild,Nothing,"Child")
.InsertItem(hChild,Nothing,"Child")
.InsertItem(h,Nothing,"Child")
End With
.EndUpdate()
End With
|
974
|
I'm trying to use automatic numbering of the outline. How can I have A, B, C for root items, 1, 2, 3 for the sub-items, and a, b, c for sub-sub-items (sample 1)
![](images/exgridq974.png)
Dim h,hChild
With AxGrid1
.BeginUpdate()
.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exLinesAtRoot
.DrawGridLines = EXGRIDLib.GridLinesEnum.exRowLines
.AutoDrag = EXGRIDLib.AutoDragEnum.exAutoDragPositionAny
.HasLines = EXGRIDLib.HierarchyLineEnum.exSolidLine
.Indent = 16
With .Columns
.Add("Default")
With .Add("")
.Def(EXGRIDLib.DefColumnEnum.exCellValueFormat) = 1
.Def(EXGRIDLib.DefColumnEnum.exCellPaddingRight) = 4
.Alignment = EXGRIDLib.AlignmentEnum.RightAlignment
.AllowSizing = False
.Width = 24
.Position = 0
.FormatColumn = "(1:=(0 :=(1 rpos '.|A-Z||a-z|')) rfind `.`) < 0 ? `<b>` + =:0 : `<i>` + (=:0 mid (1 + 1 + =:1) ) "
End With
End With
With .Items
h = .AddItem("Root")
.InsertItem(h,Nothing,"Child")
hChild = .InsertItem(h,Nothing,"Child")
.InsertItem(hChild,Nothing,"Child")
.InsertItem(hChild,Nothing,"Child")
.InsertItem(hChild,Nothing,"Child")
.InsertItem(h,Nothing,"Child")
.ExpandItem(0) = True
h = .AddItem("Root")
.InsertItem(h,Nothing,"Child")
hChild = .InsertItem(h,Nothing,"Child")
.CellState(hChild,0) = 1
.InsertItem(hChild,Nothing,"Child")
.InsertItem(hChild,Nothing,"Child")
.InsertItem(hChild,Nothing,"Child")
.InsertItem(h,Nothing,"Child")
End With
.EndUpdate()
End With
|
973
|
How can I programmatically group by columns, without having the control's sort bar visible
![](images/exgridq973.png)
Dim rs
With AxGrid1
.BeginUpdate()
.ColumnAutoResize = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.SortBarHeight = 0
.SortBarVisible = True
.SortBarCaption = "Drag a <b>column</b> header here to group by that column."
.AllowGroupBy = True
.Layout = "multiplesort=""C1:2"""
.EndUpdate()
End With
|
972
|
How do I perform my own sort
![](images/exgridq972.png)
' Sort event - Fired when the control sorts a column.
Private Sub AxGrid1_Sort(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxGrid1.Sort
With AxGrid1
Debug.Print( "Sort" )
With .Items
.ItemPosition(.ItemByIndex(1)) = 0
.ItemPosition(.ItemByIndex(0)) = 1
End With
End With
End Sub
Dim h
With AxGrid1
.BeginUpdate()
.SingleSort = False
.SortOnClick = EXGRIDLib.SortOnClickEnum.exUserSort
With .Columns
.Add("Index").FormatColumn = "0 index ``"
.Add("Data 1")
.Add("Data 2")
End With
With .Items
h = .AddItem(0)
.CellValue(h,1) = 2
.CellValue(h,2) = 3
h = .AddItem(4)
.CellValue(h,1) = 5
.CellValue(h,2) = 6
h = .AddItem(7)
.CellValue(h,1) = 8
.CellValue(h,2) = 9
End With
.Layout = "multiplesort=""C1:1 C2:2"""
.EndUpdate()
End With
|
971
|
Is it possible to have a different alignment for parts of the cell's caption
![](images/exgridq971.png)
Dim h
With AxGrid1
.BeginUpdate()
.TreeColumnIndex = -1
.DrawGridLines = EXGRIDLib.GridLinesEnum.exRowLines
With .Columns.Add("Default")
.Def(EXGRIDLib.DefColumnEnum.exCellHasCheckBox) = True
End With
With .Items
.CellHAlignment(.AddItem("all-left"),0) = EXGRIDLib.AlignmentEnum.LeftAlignment
.CellHAlignment(.AddItem("all-center"),0) = EXGRIDLib.AlignmentEnum.CenterAlignment
.CellHAlignment(.AddItem("all-right"),0) = EXGRIDLib.AlignmentEnum.RightAlignment
h = .AddItem("left<c>center<r>right")
.CellValueFormat(h,0) = EXGRIDLib.ValueFormatEnum.exHTML
End With
.EndUpdate()
End With
|
970
|
I have a column with Def(exCellSingleLine) property on False, word-wrapping, and I am wondering if possible to update the column's content while user is resizing it
With AxGrid1
.BeginUpdate()
With .Columns
With .Add("MultipleLine")
.Width = 32
.Def(EXGRIDLib.DefColumnEnum.exCellSingleLine) = False
.Def(EXGRIDLib.DefColumnEnum.exColumnResizeContiguously) = True
End With
With .Add("SingleLine")
.Def(EXGRIDLib.DefColumnEnum.exCellSingleLine) = False
End With
End With
With .Items
.CellValue(.AddItem("This is a bit of long text that should break the line"),1) = "This is a bit of long text that should break the line"
End With
.EndUpdate()
End With
|
969
|
How can I get the absolute position of an item
' MouseMove event - Occurs when the user moves the mouse.
Private Sub AxGrid1_MouseMoveEvent(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_MouseMoveEvent) Handles AxGrid1.MouseMoveEvent
Dim c,hit
With AxGrid1
With .Items
Debug.Print( .CellCaption(AxGrid1.ItemFromPoint(-1,-1,c,hit),"Position") )
End With
End With
End Sub
Dim h
With AxGrid1
.BeginUpdate()
.BackColorAlternate = RGB(240,240,240)
.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exLinesAtRoot
.Columns.Add("Def").DisplayFilterButton = True
With .Items
h = .AddItem("Root")
.InsertItem(.InsertItem(h,Nothing,"Child 1"),Nothing,"Sub-Child 1")
.InsertItem(.InsertItem(h,Nothing,"Child 2"),Nothing,"Sub-Child 2")
End With
.PutItems(.GetItems(-1))
.PutItems(.GetItems(-1))
.PutItems(.GetItems(-1))
With .Columns.Add("Position")
.FormatColumn = "1 apos ``"
.Visible = False
End With
.EndUpdate()
End With
|
968
|
I am using ExComboBox as an user editor, how can I display a different column
![](images/exgridq968.png)
' UserEditorClose event - Fired the user editor is about to be opened.
Private Sub AxGrid1_UserEditorClose(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_UserEditorCloseEvent) Handles AxGrid1.UserEditorClose
' Items.CellValue(Item,ColIndex) = Object.Value
End Sub
' UserEditorOleEvent event - Occurs when an user editor fires an event.
Private Sub AxGrid1_UserEditorOleEvent(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_UserEditorOleEventEvent) Handles AxGrid1.UserEditorOleEvent
With AxGrid1
Debug.Print( e.ev )
End With
End Sub
' UserEditorOpen event - Occurs when an user editor is about to be opened.
Private Sub AxGrid1_UserEditorOpen(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_UserEditorOpenEvent) Handles AxGrid1.UserEditorOpen
' Object.Value = Me.Items.CellValue(Item,ColIndex)
End Sub
Dim rs
With AxGrid1
.BeginUpdate()
With .Columns.Add("Exontrol.ComboBox").Editor
.EditType = EXGRIDLib.EditTypeEnum.UserEditorType
.UserEditor("Exontrol.ComboBox","")
With .UserEditorObject
.BeginUpdate()
.Style = 2
.ColumnAutoResize = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.Alignment = 0
.IntegralHeight = True
.MinHeightList = 128
.MinWidthList = 648
.HeaderHeight = 36
.AllowSizeGrip = True
.SingleEdit = True
.LabelColumnIndex = 7
.SearchColumnIndex = 0
With .Columns.Item(0)
.HeaderBold = True
.HTMLCaption = "OrderID<br><fgcolor=808080>(search)"
End With
With .Columns.Item(7)
.HeaderBold = True
.HTMLCaption = "ShipName<br><fgcolor=808080>(display)"
.Width = 128
End With
.UseTabKey = False
.EndUpdate()
End With
End With
.DrawGridLines = EXGRIDLib.GridLinesEnum.exRowLines
.DefaultItemHeight = 21
With .Items
.CellEditorVisible(.AddItem(10248),0) = EXGRIDLib.EditorVisibleEnum.exEditorVisible
.CellEditorVisible(.AddItem(10249),0) = EXGRIDLib.EditorVisibleEnum.exEditorVisible
.CellEditorVisible(.AddItem(10250),0) = EXGRIDLib.EditorVisibleEnum.exEditorVisible
End With
.EndUpdate()
End With
|
967
|
How do I sort the index column as numeric (Method 3)
![](images/exgridq967.png)
' AddItem event - Occurs after a new Item has been inserted to Items collection.
Private Sub AxGrid1_AddItem(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_AddItemEvent) Handles AxGrid1.AddItem
With AxGrid1
With .Items
.CellData(e.item,1) = .CellCaption(e.item,1)
End With
End With
End Sub
With AxGrid1
.BeginUpdate()
.DrawGridLines = EXGRIDLib.GridLinesEnum.exAllLines
.ColumnAutoResize = True
.ShowFocusRect = False
With .Columns.Add("Next")
.Def(EXGRIDLib.DefColumnEnum.exCellPaddingLeft) = 4
.Def(EXGRIDLib.DefColumnEnum.exHeaderPaddingLeft) = 4
End With
With .Columns.Add("Index")
.AllowSizing = False
.Width = 48
.FormatColumn = "(((0 := (1 index ``)) mod 3) case ( default: ``; 0 : `<r><fgcolor=B0B0B0>`; 1: ``; 2 : `<c><fgcolor=808080>` )) + str(=:0)"
.Def(EXGRIDLib.DefColumnEnum.exCellValueFormat) = 1
.SortType = EXGRIDLib.SortTypeEnum.SortUserData
.Position = 0
End With
With .Items
.AddItem("Item 1")
.AddItem("Item 2")
.AddItem("Item 3")
.AddItem("Item 4")
.AddItem("Item 5")
.AddItem("Item 6")
.AddItem("Item 7")
.AddItem("Item 8")
.AddItem("Item 9")
.AddItem("Item 10")
End With
.EndUpdate()
End With
|
966
|
How do I sort the index column as numeric (Method 2)
![](images/exgridq966.png)
' AddItem event - Occurs after a new Item has been inserted to Items collection.
Private Sub AxGrid1_AddItem(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_AddItemEvent) Handles AxGrid1.AddItem
With AxGrid1
With .Items
.CellSortData(e.item,1) = .CellCaption(e.item,1)
End With
End With
End Sub
With AxGrid1
.BeginUpdate()
.DrawGridLines = EXGRIDLib.GridLinesEnum.exAllLines
.ColumnAutoResize = True
.ShowFocusRect = False
With .Columns.Add("Next")
.Def(EXGRIDLib.DefColumnEnum.exCellPaddingLeft) = 4
.Def(EXGRIDLib.DefColumnEnum.exHeaderPaddingLeft) = 4
End With
With .Columns.Add("Index")
.AllowSizing = False
.Width = 48
.FormatColumn = "(((0 := (1 index ``)) mod 3) case ( default: ``; 0 : `<r><fgcolor=B0B0B0>`; 1: ``; 2 : `<c><fgcolor=808080>` )) + str(=:0)"
.Def(EXGRIDLib.DefColumnEnum.exCellValueFormat) = 1
.SortType = EXGRIDLib.SortTypeEnum.SortCellData
.Position = 0
End With
With .Items
.AddItem("Item 1")
.AddItem("Item 2")
.AddItem("Item 3")
.AddItem("Item 4")
.AddItem("Item 5")
.AddItem("Item 6")
.AddItem("Item 7")
.AddItem("Item 8")
.AddItem("Item 9")
.AddItem("Item 10")
End With
.EndUpdate()
End With
|
965
|
How do I sort the index column as numeric (Method 1)
![](images/exgridq965.png)
With AxGrid1
.BeginUpdate()
With .Columns.Add("Sort Index As String (Default)")
.FormatColumn = "1 index ``"
End With
With .Columns.Add("Sort Index As Numeric")
.ComputedField = "%C0"
.SortType = EXGRIDLib.SortTypeEnum.SortNumeric
End With
With .Items
.AddItem("")
.AddItem("")
.AddItem("")
.AddItem("")
.AddItem("")
.AddItem("")
.AddItem("")
.AddItem("")
.AddItem("")
.AddItem("")
End With
.EndUpdate()
End With
|
964
|
How can I put icons/images into buttons
![](images/exgridq964.png)
With AxGrid1
.BeginUpdate()
.ColumnAutoResize = True
.Images("gBJJgBAIDAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTq" & _
"lVq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBwWDwmFw2HxGJxWLxmNx0xiFdyOTh8Tf9ZymXx+QytcyNgz8r0OblWjyWds+m" & _
"0ka1Vf1ta1+r1mos2xrG2xeZ0+a0W0qOx3GO4NV3WeyvD2XJ5XL5nN51aiw+lfSj0gkUkAEllHanHI5j/cHg8EZf7w8vl8j4f/qfEZeB09/vjLAB30+kZQAP/P5/H6/y" & _
"NAOAEAwCjMBwFAEDwJBMDwLBYAP2/8Hv8/gAGAD8LQs9w/nhDY/oygIA=")
With .Columns.Add("C+B")
.AllowSizing = False
.Width = 48
.FormatColumn = "` <img>` + ( 1 + (1 index ``) mod 3 ) + `</img> `"
.Def(EXGRIDLib.DefColumnEnum.exCellValueFormat) = 1
.Def(EXGRIDLib.DefColumnEnum.exCellHasCheckBox) = True
.Def(EXGRIDLib.DefColumnEnum.exCellHasButton) = True
.Def(EXGRIDLib.DefColumnEnum.exCellButtonAutoWidth) = True
End With
.Columns.Add("")
.DrawGridLines = EXGRIDLib.GridLinesEnum.exVLines
.DefaultItemHeight = 20
With .Items
.AddItem("")
.AddItem("")
.AddItem("")
.AddItem("")
.AddItem("")
.AddItem("")
.AddItem("")
.AddItem("")
End With
.EndUpdate()
End With
|
963
|
Is it possible to have a CheckBox and Button TOGETHER on all cells in a column
![](images/exgridq963.png)
' ButtonClick event - Occurs when user clicks on the cell's button.
Private Sub AxGrid1_ButtonClick(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_ButtonClickEvent) Handles AxGrid1.ButtonClick
With AxGrid1
Debug.Print( "ButtonClick" )
Debug.Print( e.item )
Debug.Print( e.key )
End With
End Sub
' CellStateChanged event - Fired after cell's state has been changed.
Private Sub AxGrid1_CellStateChanged(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_CellStateChangedEvent) Handles AxGrid1.CellStateChanged
With AxGrid1
Debug.Print( "CellStateChanged" )
Debug.Print( e.item )
End With
End Sub
With AxGrid1
.BeginUpdate()
.ColumnAutoResize = True
With .Columns.Add("")
.AllowSizing = False
.Width = 32
.FormatColumn = "1 index ``"
End With
With .Columns.Add("Def")
.AllowSizing = False
.Width = 48
.FormatColumn = "` `"
.Def(EXGRIDLib.DefColumnEnum.exCellHasCheckBox) = True
.Def(EXGRIDLib.DefColumnEnum.exCellHasButton) = True
.Def(EXGRIDLib.DefColumnEnum.exCellButtonAutoWidth) = True
End With
.Columns.Add("")
With .Items
.AddItem("")
.AddItem("")
.AddItem("")
.AddItem("")
.AddItem("")
.AddItem("")
.AddItem("")
.AddItem("")
End With
.EndUpdate()
End With
|
962
|
I have columns that look up the same data. (e.g. different contact) so both could / should use the same editor. Is this possible, to use other column's editor
![](images/exgridq962.png)
Dim h,var_Editor
With AxGrid1
.BeginUpdate()
.SelBackColor = .BackColor
.SelForeColor = .ForeColor
With .Columns
With .Add("Pos")
.Width = 32
.AllowSizing = False
.FormatColumn = "1 index ``"
End With
var_Editor = .Add("C1").Editor
With var_Editor
.EditType = EXGRIDLib.EditTypeEnum.ColorListType
.ClearItems()
.AddItem(255,"Red Color")
.AddItem(16711680,"Blue Color")
.AddItem(65280,"Green Color")
End With
.Add("C2").Editor.EditType = EXGRIDLib.EditTypeEnum.CloneType Or EXGRIDLib.EditTypeEnum.EditType
.Add("C3").Editor.EditType = EXGRIDLib.EditTypeEnum.CloneType Or EXGRIDLib.EditTypeEnum.EditType
End With
With .Items
h = .AddItem("")
.CellValue(h,1) = 16711680
.CellValue(h,2) = 65280
.CellValue(h,3) = 255
h = .AddItem("")
.CellValue(h,1) = 255
.CellValue(h,2) = 16711680
.CellValue(h,3) = 65280
End With
.EndUpdate()
End With
|
961
|
Is there an easy way to get an effect like in a Microsoft Access / SQL-Server Table view, where you can scroll-up till the last row containing data is displayed as top-row
![](images/exgridq961.png)
Dim rs
With AxGrid1
.BeginUpdate()
.HasLines = EXGRIDLib.HierarchyLineEnum.exNoLine
.ColumnAutoResize = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.ScrollBars = EXGRIDLib.ScrollBarsEnum.exVScrollEmptySpace Or EXGRIDLib.ScrollBarsEnum.exBoth
.set_ScrollPos(True,.Items.ItemCount)
.EndUpdate()
End With
|
960
|
Does filtering work with umlauts / accents characters
With AxGrid1
.BeginUpdate()
With .Columns.Add("Names")
.DisplayFilterButton = True
.FilterType = EXGRIDLib.FilterTypeEnum.exPattern
End With
With .Items
.AddItem("Mantel")
.AddItem("Mechanik")
.AddItem("Motor")
.AddItem("Murks")
.AddItem("Märchen")
.AddItem("Möhren")
.AddItem("Mühle")
.AddItem("Sérigraphie")
End With
.Columns.Item(0).Filter = "*ä*"
.ApplyFilter()
.EndUpdate()
End With
|
959
|
How FullPath method works
![](images/exgridq959.png)
Dim h
With AxGrid1
.BeginUpdate()
.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exLinesAtRoot
.Columns.Add("C1")
.Columns.Add("C2")
With .Items
h = .AddItem("Root")
.CellValue(h,1) = "A"
.CellValue(.InsertItem(h,Nothing,"Child 1"),1) = "B"
.CellValue(.InsertItem(h,Nothing,"Child 2"),1) = "C"
.ExpandItem(h) = True
End With
.SearchColumnIndex = 1
Debug.Print( .SearchColumnIndex )
Debug.Print( .FullPath(.Items.ItemByIndex(2)) )
.SearchColumnIndex = 0
Debug.Print( .SearchColumnIndex )
Debug.Print( .FullPath(.Items.ItemByIndex(2)) )
.EndUpdate()
End With
|
958
|
Can I set the search box / filterbarprompt to invisible, so I can use my own input and *string* via VBA
Dim h0
With AxGrid1
.BeginUpdate()
.ColumnAutoResize = True
.ContinueColumnScroll = False
.MarkSearchColumn = False
.SearchColumnIndex = 1
.FilterBarHeight = 0
.FilterBarPromptVisible = EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible
With .Columns
.Add("Name").Width = 96
.Add("Title").Width = 96
.Add("City")
End With
With .Items
h0 = .AddItem("Nancy Davolio")
.CellValue(h0,1) = "Sales Representative"
.CellValue(h0,2) = "Seattle"
h0 = .AddItem("Andrew Fuller")
.CellValue(h0,1) = "Vice President, Sales"
.CellValue(h0,2) = "Tacoma"
.SelectItem(h0) = True
h0 = .AddItem("Janet Leverling")
.CellValue(h0,1) = "Sales Representative"
.CellValue(h0,2) = "Kirkland"
h0 = .AddItem("Margaret Peacock")
.CellValue(h0,1) = "Sales Representative"
.CellValue(h0,2) = "Redmond"
h0 = .AddItem("Steven Buchanan")
.CellValue(h0,1) = "Sales Manager"
.CellValue(h0,2) = "London"
h0 = .AddItem("Michael Suyama")
.CellValue(h0,1) = "Sales Representative"
.CellValue(h0,2) = "London"
h0 = .AddItem("Robert King")
.CellValue(h0,1) = "Sales Representative"
.CellValue(h0,2) = "London"
h0 = .AddItem("Laura Callahan")
.CellValue(h0,1) = "Inside Sales Coordinator"
.CellValue(h0,2) = "Seattle"
h0 = .AddItem("Anne Dodsworth")
.CellValue(h0,1) = "Sales Representative"
.CellValue(h0,2) = "London"
End With
.FilterBarPromptPattern = "London"
.EndUpdate()
End With
|
957
|
How to load a hierarchy using the control's DataSource property (Parent-ID-Relation)
![](images/exgridq957.png)
' AddItem event - Occurs after a new Item has been inserted to Items collection.
Private Sub AxGrid1_AddItem(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_AddItemEvent) Handles AxGrid1.AddItem
With AxGrid1
With .Items
.SetParent(e.item,.FindItem(.CellValue(e.item,"ReportsTo"),"EmployeeID"))
End With
End With
End Sub
Dim rs
With AxGrid1
.BeginUpdate()
.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exLinesAtRoot
.ColumnAutoResize = False
.ContinueColumnScroll = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("SELECT * FROM Employees ORDER BY ReportsTo","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.Items.ExpandItem(0) = True
.EndUpdate()
End With
|
956
|
Is it possible to select the entire row/line, when user clicks the first column, and select individually the rest of cells, while user clicks any other column
![](images/exgridq956.png)
' MouseDown event - Occurs when the user presses a mouse button.
Private Sub AxGrid1_MouseDownEvent(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_MouseDownEvent) Handles AxGrid1.MouseDownEvent
Dim c,hit,i
With AxGrid1
i = .get_ItemFromPoint(-1,-1,c,hit)
.FullRowSelect = .Columns.Item(c).Data
End With
End Sub
Dim rs
With AxGrid1
.BeginUpdate()
.HeaderHeight = 22
.HeaderAppearance = EXGRIDLib.AppearanceEnum.Flat
.BackColorLock = RGB(240,240,240)
.BackColorHeader = .BackColorLock
.HasLines = EXGRIDLib.HierarchyLineEnum.exNoLine
.ColumnAutoResize = False
.SortBarVisible = False
.AllowGroupBy = True
.ReadOnly = EXGRIDLib.ReadOnlyEnum.exReadOnly
.ShowFocusRect = False
.CountLockedColumns = 1
.AutoDrag = EXGRIDLib.AutoDragEnum.exAutoDragScroll
.SingleSort = False
.ColumnsAllowSizing = True
.DrawGridLines = EXGRIDLib.GridLinesEnum.exAllLines
.GridLineStyle = EXGRIDLib.GridLinesStyleEnum.exGridLinesSolid
.GridLineColor = RGB(220,220,220)
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.Columns.Item(0).Data = -1
.Layout = "singlesort=""C5:1"";multiplesort="" C1:2"""
.EndUpdate()
End With
|
955
|
The user are not able to size the columns at runtime when using HeaderAppearance property on zero
With AxGrid1
.VisualAppearance.Add(1,"gBFLBCJwBAEHhEJAAEhABJEIQAAYAQGKIYBkAKBQAGaAoDDcMQ5QwAAyDGKEEwsACEIrjKCRShyCYZRhGcTSBCIZBqEqSZLiEZRQiiCYsS5GQBSFDcOwHGyQZonKK3L" & _
"hGCYBgIA=")
.HeaderAppearance = &H1000000
.Columns.Add(1)
.Columns.Add(2)
.Columns.Add(3)
End With
|
954
|
Is it possible to embed the exGauge into the exGrid control
![](images/exgridq954.png)
' ItemOleEvent event - Fired when an ActiveX control hosted by an item has fired an event.
Private Sub AxGrid1_ItemOleEvent(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_ItemOleEventEvent) Handles AxGrid1.ItemOleEvent
Dim v
With AxGrid1
With .Items.ItemObject(AxGrid1.Items.ItemByIndex(2))
v = .FormatABC("date(`now`)")
.Layers.Item("sec").Value = v
.Layers.Item("min").Value = v
.Layers.Item("hour").Value = v
End With
End With
End Sub
' MouseMove event - Occurs when the user moves the mouse.
Private Sub AxGrid1_MouseMoveEvent(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_MouseMoveEvent) Handles AxGrid1.MouseMoveEvent
With AxGrid1
With .Items.ItemObject(AxGrid1.Items.ItemByIndex(2))
.TimerInterval = 1000
End With
End With
End Sub
Dim h,v
With AxGrid1
.BeginUpdate()
.ScrollBySingleLine = True
.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exLinesAtRoot
.HasLines = EXGRIDLib.HierarchyLineEnum.exThinLine
.ScrollBySingleLine = True
.Columns.Add("Default")
With .Items
h = .AddItem("Normal Item")
h = .AddItem("Gauge-Clock Inside")
.ExpandItem(h) = True
h = .InsertControlItem(h,"Exontrol.Gauge")
.ItemHeight(h) = 256
With .ItemObject(h)
.PicturesPath = "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Clock"
.DefaultLayer(185) = 2
.Layers.Count = 4
With .Layers.Item(0)
.Background.Picture.Name = "vista_clock.png"
End With
With .Layers.Item(1)
.Position = 3
.Key = "sec"
.OnDrag = 2
.Selectable = False
.Background.Picture.Name = "second-hand.png"
.ValueToRotateAngle = "((2:=(((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 )) - " & _
"floor(=:1)) * 60 )) - floor(=:2) ) * 360"
.RotateAngleToValue = "value / 360 / 24 / 60"
End With
With .Layers.Item(2)
.Position = 2
.Key = "min"
.OnDrag = 2
.Selectable = False
.Background.Picture.Name = "Minute.png"
.ValueToRotateAngle = "((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 )) - floor(" & _
"=:1)) * 360"
.RotateAngleToValue = "value / 360 / 24 / 60"
End With
With .Layers.Item(3)
.Position = 1
.Key = "hour"
.OnDrag = 2
.Background.Picture.Name = "Hour.png"
.ValueToRotateAngle = "2 * 360 * ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) )"
.RotateAngleToValue = "value / 360 * 0.5"
End With
v = .FormatABC("date(`now`)")
.Layers.Item("sec").Value = v
.Layers.Item("min").Value = v
.Layers.Item("hour").Value = v
End With
h = .AddItem("Normal Item")
End With
.EndUpdate()
End With
|
953
|
What's the difference between merge cells and divider item
![](images/exgridq953.png)
' AddItem event - Occurs after a new Item has been inserted to Items collection.
Private Sub AxGrid1_AddItem(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_AddItemEvent) Handles AxGrid1.AddItem
With AxGrid1
With .Items
.CellBackColor(e.item,0) = RGB(240,240,240)
.ItemHasChildren(e.item) = True
End With
End With
End Sub
Dim h
With AxGrid1
.BeginUpdate()
.TreeColumnIndex = 0
.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exLinesAtRoot
.DrawGridLines = EXGRIDLib.GridLinesEnum.exAllLines
.Columns.Add("C1").FormatColumn = "1 index `A-Z`"
.Columns.Add("C2").FormatColumn = "1 index ``"
.Columns.Add("C3").FormatColumn = "1 index ``"
With .Items
.AddItem()
.AddItem()
h = .AddItem()
.CellMerge(h,0) = 1
.FormatCell(h,0) = "`merge cells`"
.CellHAlignment(h,0) = EXGRIDLib.AlignmentEnum.CenterAlignment
h = .AddItem()
.ItemDivider(h) = 0
.CellHAlignment(h,0) = EXGRIDLib.AlignmentEnum.CenterAlignment
.FormatCell(h,0) = "`item divider`"
.AddItem()
.AddItem()
End With
.EndUpdate()
End With
|
952
|
is it possible to resize a column with the mouse without changing the width of the next column
![](images/exgridq952.png)
With AxGrid1
.BeginUpdate()
.ColumnAutoResize = False
.Columns.Add("Column 1").Width = 256
.Columns.Add("Column 2").Width = 512
.DrawGridLines = EXGRIDLib.GridLinesEnum.exAllLines
.EndUpdate()
End With
|
951
|
How do I ensure that the newly item fits the control's client area
![](images/exgridq951.png)
' ButtonClick event - Occurs when user clicks on the cell's button.
Private Sub AxGrid1_ButtonClick(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_ButtonClickEvent) Handles AxGrid1.ButtonClick
Dim h
With AxGrid1
With .Items
h = .AddItem("")
.SelectItem(h) = True
.EnsureVisibleItem(h)
End With
.FocusColumnIndex = 0
End With
End Sub
With AxGrid1
.BeginUpdate()
With .Columns.Add("")
.AllowSizing = False
.AllowDragging = False
.AllowSort = False
.Width = 24
.Def(EXGRIDLib.DefColumnEnum.exCellHasButton) = True
End With
.Columns.Add("Position").FormatColumn = "1 apos `A-Z`"
.CountLockedColumns = 1
With .Items
.AddItem("")
.AddItem("")
.AddItem("")
End With
.EndUpdate()
End With
|
950
|
How do I find the predefined string for giving value, or giving identifier for specified predefined caption of editor
![](images/exgridq950.png)
' Change event - Occurs when the user changes the cell's content.
Private Sub AxGrid1_Change(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_ChangeEvent) Handles AxGrid1.Change
With AxGrid1
Debug.Print( "FindItem(numeric) is " )
Debug.Print( e.newValue )
Debug.Print( .Columns.Item(0).Editor.FindItem(e.newValue) )
End With
End Sub
With AxGrid1
.BeginUpdate()
With .Columns.Add("DropDownList")
With .Editor
.EditType = EXGRIDLib.EditTypeEnum.DropDownListType
.AddItem(1,"Ken Robinson")
.AddItem(2,"Dave Nichols")
.AddItem(3,"Zane Thomas")
.AddItem(4,"James Shields")
End With
End With
With .Columns.Add("CellValue")
.FormatColumn = "%0"
.Def(EXGRIDLib.DefColumnEnum.exCellBackColor) = 15790320
.Def(EXGRIDLib.DefColumnEnum.exHeaderBackColor) = .Def(EXGRIDLib.DefColumnEnum.exCellBackColor)
End With
With .Columns.Add("CellCaption")
.FormatColumn = "%C0"
.Def(EXGRIDLib.DefColumnEnum.exCellBackColor) = 15790320
.Def(EXGRIDLib.DefColumnEnum.exHeaderBackColor) = .Def(EXGRIDLib.DefColumnEnum.exCellBackColor)
End With
With .Items
.AddItem(1)
.AddItem(AxGrid1.Columns.Item(0).Editor.FindItem("Zane Thomas"))
.AddItem(2)
End With
.EndUpdate()
End With
|
949
|
How can I align captions of items with checkbox, with items with no checkbox
![](images/exgridq949.png)
With AxGrid1
.BeginUpdate()
.Columns.Add("Default")
With .Items
.CellImages(.AddItem(0),0) = "1"
.CellHasCheckBox(.AddItem(1),0) = True
.CellImages(.AddItem(2),0) = "1"
End With
.EndUpdate()
End With
|
948
|
How can I prevent sorting a column
![](images/exgridq948.png)
Dim h
With AxGrid1
.BeginUpdate()
.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exLinesAtRoot
With .Columns.Add("Default")
.Def(EXGRIDLib.DefColumnEnum.exCellHasCheckBox) = True
.PartialCheck = True
.AllowSort = False
End With
With .Items
h = .AddItem("Root")
.InsertItem(h,Nothing,"Child 1")
.InsertItem(h,Nothing,"Child 2")
.ExpandItem(h) = True
End With
.EndUpdate()
End With
|
947
|
Is there a possibility to group without moving and showing the column to the SortBar
![](images/exgridq947.png)
Dim rs
With AxGrid1
.BeginUpdate()
.HasLines = EXGRIDLib.HierarchyLineEnum.exNoLine
.ColumnAutoResize = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.SingleSort = False
.SortBarVisible = False
.AllowGroupBy = True
.Layout = "singlesort=""C5:1"";multiplesort="" C1:2"""
.EndUpdate()
End With
|
946
|
How can I show each group header ( not-subroup ), with a different background color, while alternate background colors for inside items
![](images/exgridq946.png)
' LayoutChanged event - Occurs when column's position or column's size is changed.
Private Sub AxGrid1_LayoutChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxGrid1.LayoutChanged
With AxGrid1
.Refresh()
End With
End Sub
Dim rs
With AxGrid1
.BeginUpdate()
.HasLines = EXGRIDLib.HierarchyLineEnum.exNoLine
.ColumnAutoResize = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.SingleSort = False
.SortBarVisible = True
.AllowGroupBy = True
.Columns.Item(1).SortOrder = True
With .Columns.Add("Position")
.FormatColumn = "(0:= (1 rpos '')) right ( ( 1:= ( =:0 rfind `.` ) ) != -1 ? =:1 : len(=:0))"
.Visible = False
End With
With .Columns.Add("Position")
.FormatColumn = "(1 rpos '') contains '.'"
.Visible = False
End With
.ConditionalFormats.Add("(%C13 mod 2) != 0").BackColor = RGB(240,240,240)
.ConditionalFormats.Add("%C14 = 0").BackColor = RGB(190,190,190)
.EndUpdate()
End With
|
945
|
What is the difference between %0 and %C0, when using in expressions ( format, conditional format, computed fields, and so on )
![](images/exgridq945.png)
With AxGrid1
.BeginUpdate()
.HeaderAppearance = EXGRIDLib.AppearanceEnum.Etched
.HeaderHeight = 24
.ScrollBySingleLine = True
.DrawGridLines = EXGRIDLib.GridLinesEnum.exRowLines
.Columns.Add("Value").Def(EXGRIDLib.DefColumnEnum.exCellValueFormat) = 1
With .Columns.Add("FormatColumn = `%0` ~ CellValue")
.FormatColumn = "%0"
.Def(EXGRIDLib.DefColumnEnum.exCellSingleLine) = False
End With
With .Columns.Add("FormatColumn = `%C0`~ CellCaption")
.FormatColumn = "%C0"
.Def(EXGRIDLib.DefColumnEnum.exCellSingleLine) = False
End With
With .Items
.AddItem(1.1234)
.CellValueFormat(.AddItem("<sha ;;0>This <fgcolor=FF0000>is a <s><b>HTM</fgcolor>L</b> text</s>."),0) = EXGRIDLib.ValueFormatEnum.exHTML
With .CellEditor(.AddItem(3))
.EditType = EXGRIDLib.EditTypeEnum.CheckListType
.AddItem(1,"Border")
.AddItem(2,"Thick")
.AddItem(4,"Shadow")
End With
.FormatCell(.AddItem(10000),0) = "`<b>` + currency(value)"
End With
.EndUpdate()
End With
|
944
|
How can I alternate colors for each group header ( not-subroup ), with a different background color, while items of the same group showing with a different color
![](images/exgridq944.png)
' LayoutChanged event - Occurs when column's position or column's size is changed.
Private Sub AxGrid1_LayoutChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxGrid1.LayoutChanged
With AxGrid1
.Refresh()
End With
End Sub
Dim rs
With AxGrid1
.BeginUpdate()
.HasLines = EXGRIDLib.HierarchyLineEnum.exNoLine
.ColumnAutoResize = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.SingleSort = False
.SortBarVisible = True
.AllowGroupBy = True
.Columns.Item(1).SortOrder = True
With .Columns.Add("Position")
.FormatColumn = "(0:= (1 rpos '')) left ( ( 1:= ( =:0 lfind `.` ) ) != -1 ? =:1 : len(=:0))"
.Visible = False
End With
With .Columns.Add("Position")
.FormatColumn = "(1 rpos '') contains '.'"
.Visible = False
End With
.ConditionalFormats.Add("(%C13 mod 2) != 0").BackColor = RGB(240,240,240)
.ConditionalFormats.Add("%C14 = 0").BackColor = RGB(190,190,190)
.EndUpdate()
End With
|
943
|
How can I highlight each group header, with a different background color (method 2)
![](images/exgridq943.png)
' AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection.
Private Sub AxGrid1_AddGroupItem(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_AddGroupItemEvent) Handles AxGrid1.AddGroupItem
With AxGrid1
.Items.ItemBackColor(e.item) = RGB(190,190,190)
End With
End Sub
Dim rs
With AxGrid1
.BeginUpdate()
.HasLines = EXGRIDLib.HierarchyLineEnum.exNoLine
.ColumnAutoResize = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.SingleSort = False
.SortBarVisible = True
.AllowGroupBy = True
.Columns.Item(1).SortOrder = True
.EndUpdate()
End With
|
942
|
How can I highlight each group header ( not-subroup ), with a different background color (method 1)
![](images/exgridq942.png)
' LayoutChanged event - Occurs when column's position or column's size is changed.
Private Sub AxGrid1_LayoutChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxGrid1.LayoutChanged
With AxGrid1
.Refresh()
End With
End Sub
Dim rs
With AxGrid1
.BeginUpdate()
.HasLines = EXGRIDLib.HierarchyLineEnum.exNoLine
.ColumnAutoResize = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.SingleSort = False
.SortBarVisible = True
.AllowGroupBy = True
.Columns.Item(1).SortOrder = True
With .Columns.Add("Position")
.FormatColumn = "(0:= (1 rpos '')) left ( ( 1:= ( =:0 lfind `.` ) ) != -1 ? =:1 : len(=:0))"
.Visible = False
End With
With .Columns.Add("Position")
.FormatColumn = "(1 rpos '') contains '.'"
.Visible = False
End With
.ConditionalFormats.Add("%C14 = 0").BackColor = RGB(190,190,190)
.EndUpdate()
End With
|
941
|
The BackColorAlternate displays each second row with a different background color. Is it possible to apply a different background color, for each sub-tree, ConditionalFormats, Add
![](images/exgridq941.png)
' LayoutChanged event - Occurs when column's position or column's size is changed.
Private Sub AxGrid1_LayoutChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxGrid1.LayoutChanged
With AxGrid1
.Refresh()
End With
End Sub
' Sort event - Fired when the control sorts a column.
Private Sub AxGrid1_Sort(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxGrid1.Sort
With AxGrid1
.Refresh()
End With
End Sub
Dim h
With AxGrid1
.BeginUpdate()
.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exLinesAtRoot
With .Columns.Add("P1")
.Def(EXGRIDLib.DefColumnEnum.exCellHasCheckBox) = True
.PartialCheck = True
End With
With .Columns.Add("P2")
.Def(EXGRIDLib.DefColumnEnum.exCellHasCheckBox) = True
.PartialCheck = True
End With
With .Items
h = .AddItem("Root 1")
.InsertItem(h,Nothing,"Child 1")
.InsertItem(h,Nothing,"Child 2")
.ExpandItem(h) = True
h = .AddItem("Root 2")
.InsertItem(h,Nothing,"Child 1")
.InsertItem(h,Nothing,"Child 2")
.ExpandItem(h) = True
h = .AddItem("Root 2")
.InsertItem(h,Nothing,"Child 1")
.InsertItem(h,Nothing,"Child 2")
.ExpandItem(h) = True
End With
With .Columns.Add("Position")
.FormatColumn = "(0:= (1 rpos '')) left ( ( 1:= ( =:0 lfind `.` ) ) != -1 ? =:1 : len(=:0))"
.Visible = False
End With
.ConditionalFormats.Add("(%C2 mod 2) != 0").BackColor = RGB(240,240,240)
.EndUpdate()
End With
|
940
|
The BackColorAlternate displays each second row with a different background color. Is it possible to apply a different background color, for 2nd, 3rd, 4th, row, and so on
![](images/exgridq940.png)
' LayoutChanged event - Occurs when column's position or column's size is changed.
Private Sub AxGrid1_LayoutChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxGrid1.LayoutChanged
With AxGrid1
.Refresh()
End With
End Sub
' Sort event - Fired when the control sorts a column.
Private Sub AxGrid1_Sort(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxGrid1.Sort
With AxGrid1
.Refresh()
End With
End Sub
Dim rs
With AxGrid1
.BeginUpdate()
.HasLines = EXGRIDLib.HierarchyLineEnum.exNoLine
.ColumnAutoResize = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
With .Columns.Add("Position")
.FormatColumn = "1 apos ''"
.Visible = False
End With
.ConditionalFormats.Add("(%C13 mod 5) = 1").BackColor = RGB(128,128,128)
.ConditionalFormats.Add("(%C13 mod 5) = 2").BackColor = RGB(164,164,164)
.ConditionalFormats.Add("(%C13 mod 5) = 3").BackColor = RGB(190,190,190)
.ConditionalFormats.Add("(%C13 mod 5) = 4").BackColor = RGB(240,240,240)
.EndUpdate()
End With
|
939
|
The BackColorAlternate displays each second row with a different background color. The question I have it is possible to apply a different background color for 3rd, 4th, row, and so on
![](images/exgridq939.png)
' LayoutChanged event - Occurs when column's position or column's size is changed.
Private Sub AxGrid1_LayoutChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxGrid1.LayoutChanged
With AxGrid1
.Refresh()
End With
End Sub
' Sort event - Fired when the control sorts a column.
Private Sub AxGrid1_Sort(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxGrid1.Sort
With AxGrid1
.Refresh()
End With
End Sub
Dim rs
With AxGrid1
.BeginUpdate()
.HasLines = EXGRIDLib.HierarchyLineEnum.exNoLine
.ColumnAutoResize = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
With .Columns.Add("Position")
.FormatColumn = "1 apos ''"
.Visible = False
End With
.ConditionalFormats.Add("(%C13 mod 4) = 0").BackColor = RGB(240,240,240)
.EndUpdate()
End With
|
938
|
The BackColorAlternate looks fine for flat tables, but how about using it when displaying a hierarchy/tree, like grouping rows. The sample alternate colors for each group found
![](images/exgridq938.png)
' LayoutChanged event - Occurs when column's position or column's size is changed.
Private Sub AxGrid1_LayoutChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxGrid1.LayoutChanged
With AxGrid1
.Refresh()
End With
End Sub
Dim rs
With AxGrid1
.BeginUpdate()
.HasLines = EXGRIDLib.HierarchyLineEnum.exNoLine
.ColumnAutoResize = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.SingleSort = False
.SortBarVisible = True
.AllowGroupBy = True
.Columns.Item(1).SortOrder = True
With .Columns.Add("Position")
.FormatColumn = "(0:= (1 rpos '')) left ( ( 1:= ( =:0 lfind `.` ) ) != -1 ? =:1 : len(=:0))"
.Visible = False
End With
.ConditionalFormats.Add("(%C13 mod 2) != 0").BackColor = RGB(240,240,240)
.EndUpdate()
End With
|
937
|
I need to display sub-totals in the grouping items. Is there any solution on this
![](images/exgridq937.png)
' AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection.
Private Sub AxGrid1_AddGroupItem(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_AddGroupItemEvent) Handles AxGrid1.AddGroupItem
With AxGrid1
With .Items
.ItemDivider(e.item) = -1
.EnableItem(e.item) = False
.CellValueFormat(e.item,AxGrid1.TreeColumnIndex) = EXGRIDLib.ValueFormatEnum.exHTML
.FormatCell(e.item,AxGrid1.TreeColumnIndex) = "%1"
.CellValueFormat(e.item,"Freight") = EXGRIDLib.ValueFormatEnum.exTotalField Or EXGRIDLib.ValueFormatEnum.exHTML
.CellValue(e.item,"Freight") = "sum(current,dir,%6)"
.FormatCell(e.item,"Freight") = "`<b>` + currency(value)"
End With
End With
End Sub
Dim rs
With AxGrid1
.BeginUpdate()
.SelBackMode = EXGRIDLib.BackModeEnum.exTransparent
.BackColorSortBar = RGB(240,240,240)
.ColumnAutoResize = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.SortBarVisible = True
.SortBarCaption = "Drag a <b>column</b> header here to group by that column."
.AllowGroupBy = True
.Columns.Item(1).SortOrder = EXGRIDLib.SortOrderEnum.SortAscending
.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exGroupLinesOutside
.Columns.Item("ShipVia").DisplayFilterButton = True
.EndUpdate()
End With
|
936
|
I use a subtotal in exTop-Item, after grouping the item shows 0. What is the solution
![](images/exgridq936.png)
Dim h,rs
With AxGrid1
.BeginUpdate()
.ColumnAutoResize = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.SingleSort = False
.AllowGroupBy = True
.SortBarVisible = True
.BackColorSortBar = .BackColor
.Columns.Item(5).SortOrder = EXGRIDLib.SortOrderEnum.SortAscending
.Columns.Item(6).FormatColumn = "currency(value)"
With .Items
.LockedItemCount(EXGRIDLib.VAlignmentEnum.exTop) = 1
h = .LockedItem(EXGRIDLib.VAlignmentEnum.exTop,0)
.ItemBackColor(h) = RGB(240,240,240)
.CellBackColor(h,6) = RGB(190,190,190)
.CellValue(h,6) = "sum(all,rec,%6)"
.CellValueFormat(h,6) = EXGRIDLib.ValueFormatEnum.exTotalField
End With
.Refresh()
.EndUpdate()
End With
|
935
|
I would like to avoid manual typing in the date-cell because user often type wrong things (no decimal points and so on) and so the todays-date is generated for the cell. What can be done
![](images/exgridq935.png)
' KeyPress event - Occurs when the user presses and releases an ANSI key.
Private Sub AxGrid1_KeyPressEvent(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_KeyPressEvent) Handles AxGrid1.KeyPressEvent
With AxGrid1
Debug.Print( "if .Editying != 0 then" )
Debug.Print( .Editing )
e.keyAscii = 0
End With
End Sub
With AxGrid1
.BeginUpdate()
.ColumnAutoResize = False
With .Columns
.Add("Tasks")
With .Add("Date")
.Editor.EditType = EXGRIDLib.EditTypeEnum.DateType
.Width = 128
End With
End With
With .Items
.CellValue(.AddItem("Item 1"),1) = #9/21/2006#
.CellValue(.AddItem("Item 2"),1) = #12/22/2015#
.CellValue(.AddItem("Item 3"),1) = #1/10/2015#
End With
.EndUpdate()
End With
|
934
|
The control does not ensure the item to fit the control's client area once the user clicks the cell's button or check box. What can be done
' MouseDown event - Occurs when the user presses a mouse button.
Private Sub AxGrid1_MouseDownEvent(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_MouseDownEvent) Handles AxGrid1.MouseDownEvent
' Items.EnsureVisibleItem(ItemFromPoint(-1,-1,c,hit))
End Sub
With AxGrid1
.BeginUpdate()
.TreeColumnIndex = -1
.SelForeColor = .ForeColor
With .Columns.Add("Buttons")
.Alignment = EXGRIDLib.AlignmentEnum.CenterAlignment
.Def(EXGRIDLib.DefColumnEnum.exCellHasButton) = True
End With
With .Items
.AddItem("Button A")
.AddItem("Button B")
.AddItem("Button C")
End With
.EndUpdate()
End With
|
933
|
How do you save the index number from a drop down to a database
![](images/exgridq933.png)
Dim rs
With AxGrid1
.BeginUpdate()
.ColumnAutoResize = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
With .Columns.Item("ShipVia")
.Def(EXGRIDLib.DefColumnEnum.exCellBackColor) = 15790320
.Position = 1
.Width = 96
With .Editor
.EditType = EXGRIDLib.EditTypeEnum.DropDownListType
.AddItem(1,"Speedy Express")
.AddItem(2,"United Package")
.AddItem(3,"Federal Shipping")
End With
End With
.EndUpdate()
End With
|
932
|
Is there a way to set the column width and have it stay when refreshing using the data source
![](images/exgridq932.png)
Dim rs
With AxGrid1
.BeginUpdate()
.ColumnAutoResize = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.Layout = "gBjAAwAAuABmABpABsAB0ABlAByhoAPIAOEPAA9gYABoABQAgUEg0XN4AOcJicKkpujIAGMcj0gjcGk8QhkQgUOjUEjsfkMFAB2lEnhRihcYjUvnsykQAO8oMkTNEtG" & _
"gAGUwn0uoEIhUMh0QiUOisXiE7rEyl8jAElokptYAllmpcCtMmjE3mU6jdzrUGoUKttGvFJs90oFPhVRh1Twg4wtaptco9fiMTsdIvcxw1Nkl2hUOlVwlsvnmayFAmtH" & _
"nETuWm0lAv+eAGCzFK10zp1QqVUAGOvkvuuSr0YsMUi2Y0tZ4FAztt0FvuNa23Kvt2m0YnMt5No6uxwOq0eP5cGxAAxQAxgAGwAqu/q1blHDsGW49lzPUq9qtko58r8K" & _
"rvc/LrPA7LWvw2ChpQ2j7Om7kBPK870hu+6ZQE4SJvmsT6u0x8BOa/iUP8jUANNATUrxAsKIFATvQU8DCL5B7dMWlr1u2gQZvgrsMMrDSyQ4vkcv02T+tEjUcyC1C7uw" & _
"1kVABISgwSosXq1JLyRm9EaycqqDQuyjisu+0bvY5i3udEMjTIvkuQHFEmzHNkWymwcqtNNkIN2jUbMeGsdMm4j6R/AyZT7IcztC6M+r5Qs2yYvUx0ZOTZypBqBUZPEa" & _
"Max71y6+MeTBDdBoFTjjv2z80Oi9a+VJE9HSA01SUlBbw1Ww8sPSqtFNNCdOx3L9AuQx9eVLIlUJbCa+WHVrV0fYUEMBF06UqAFh0xLLCT7abHV7P8MuNQUnW3YlDugl" & _
"rfNNcVlrzV6s3FWVKMfcVrPSq6rva0wcz8+Ue2/YK+XzQ0QUQlt83/JTr2ZdiZYBKNoTm2rH4ZedzSckqGDqAA2tEk7CSQmKEJKgWMY5CmQJlkaZYsAGMY0liFJYqKID" & _
"xhSpjCu0vUBQappOgSJZUhlBtTmyJIEqaBZVljRZe8yMZnoMl4SjQRI3qal3U7OjqPpOXNFmIAadCiHIkiDV6RjOla7puFKFnjK5/ta7Z6t6GIYkqEIQ1NmqWgIA="
.EndUpdate()
End With
|
931
|
Is it possible to decode/view the control's Layout property
![](images/exgridq931.png)
With AxGrid1
.BeginUpdate()
.SingleSort = False
.Columns.Add("C0")
.Columns.Add("C1").SortOrder = EXGRIDLib.SortOrderEnum.SortAscending
.Columns.Add("C2")
With CreateObject("Exontrol.Print")
Debug.Print( .Decode64TextW(AxGrid1.Layout) )
End With
.EndUpdate()
End With
|
930
|
How do I programmatically sort by multiple columns
![](images/exgridq930.png)
With AxGrid1
.BeginUpdate()
.SingleSort = False
.Columns.Add("C0")
.Columns.Add("C1")
.Columns.Add("C2")
.Layout = "multiplesort=""C2:1 C1:2 C0:2"""
.EndUpdate()
End With
|
929
|
Do you have any Fit-To-Page options when printing the control (W x T, Fit-To )
![](images/exgridq929.png)
Dim rs
With AxGrid1
.BeginUpdate()
.ColumnAutoResize = False
.ContinueColumnScroll = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.EndUpdate()
With CreateObject("Exontrol.Print")
.Options = "FitToPage =2 x 1"
.PrintExt = AxGrid1.GetOcx()
.Preview()
End With
End With
|
928
|
Do you have any Fit-To-Page options when printing the control ( x T, Fit-To Tall )
![](images/exgridq928.png)
Dim rs
With AxGrid1
.BeginUpdate()
.ColumnAutoResize = False
.ContinueColumnScroll = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.EndUpdate()
With CreateObject("Exontrol.Print")
.Options = "FitToPage = x 2"
.PrintExt = AxGrid1.GetOcx()
.Preview()
End With
End With
|
927
|
Do you have any Fit-To-Page options when printing the control ( W x, Fit-To Wide )
![](images/exgridq927.png)
Dim rs
With AxGrid1
.BeginUpdate()
.ColumnAutoResize = False
.ContinueColumnScroll = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.EndUpdate()
With CreateObject("Exontrol.Print")
.Options = "FitToPage = 2 x"
.PrintExt = AxGrid1.GetOcx()
.Preview()
End With
End With
|
926
|
Do you have any Fit-To-Page options when printing the control ( percent view, Adjust-To )
![](images/exgridq926.png)
Dim rs
With AxGrid1
.BeginUpdate()
.ColumnAutoResize = False
.ContinueColumnScroll = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.EndUpdate()
With CreateObject("Exontrol.Print")
.Options = "FitToPage = 50%"
.PrintExt = AxGrid1.GetOcx()
.Preview()
End With
End With
|
925
|
How can I get notified once the user expands a column
![](images/exgridq925.png)
' LayoutChanged event - Occurs when column's position or column's size is changed.
Private Sub AxGrid1_LayoutChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxGrid1.LayoutChanged
With AxGrid1
Debug.Print( "Column-Expanded" )
Debug.Print( .Columns.Item("C0").Expanded )
End With
End Sub
Dim h
With AxGrid1
.BeginUpdate()
.ShowFocusRect = False
.ColumnAutoResize = False
.DrawGridLines = EXGRIDLib.GridLinesEnum.exAllLines
.BackColorLevelHeader = .BackColor
With .Columns
With .Add("C0")
.ExpandColumns = "0,1,2"
.DisplayExpandButton = True
End With
.Add("C1")
.Add("C2")
End With
With .Items
h = .AddItem("Cell 0.0")
.CellValue(h,1) = "Cell 0.1"
.CellValue(h,2) = "Cell 0.2"
h = .AddItem("Cell 1.0")
.CellValue(h,1) = "Cell 1.1"
.CellValue(h,2) = "Cell 1.2"
End With
.EndUpdate()
End With
|
924
|
I am using expandable headers, the question is how I can display the column itself, not just the child columns
![](images/exgridq924.png)
Dim h
With AxGrid1
.BeginUpdate()
.ColumnAutoResize = False
.DrawGridLines = EXGRIDLib.GridLinesEnum.exAllLines
.BackColorLevelHeader = .BackColor
With .Columns
With .Add("C0")
.ExpandColumns = "0,1,2"
.DisplayExpandButton = True
End With
.Add("C1")
.Add("C2")
End With
With .Items
h = .AddItem("Cell 0.0")
.CellValue(h,1) = "Cell 0.1"
.CellValue(h,2) = "Cell 0.2"
h = .AddItem("Cell 1.0")
.CellValue(h,1) = "Cell 1.1"
.CellValue(h,2) = "Cell 1.2"
End With
.EndUpdate()
End With
|
923
|
How do I layout expandable columns
![](images/exgridq923.png)
With AxGrid1
.BeginUpdate()
.ColumnAutoResize = False
.DrawGridLines = EXGRIDLib.GridLinesEnum.exAllLines
.BackColorLevelHeader = .BackColor
With .Columns
With .Add("C0")
.ExpandColumns = "1,2"
.DisplayExpandButton = True
End With
.Add("C1")
.Add("C2")
.Add("C3")
With .Add("C4")
.ExpandColumns = "5,6"
.DisplayExpandButton = True
End With
.Add("C5")
With .Add("C6")
.ExpandColumns = "6,7"
.DisplayExpandButton = True
End With
.Add("C7")
End With
.EndUpdate()
.Columns.Item("C4").Expanded = False
End With
|
922
|
How do I make the control read-only (method 2)
![](images/exgridq922.png)
' Edit event - Occurs just before editing the focused cell.
Private Sub AxGrid1_EditEvent(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_EditEvent) Handles AxGrid1.EditEvent
With AxGrid1
e.cancel = True
End With
End Sub
With AxGrid1
.BeginUpdate()
With .Columns.Add("Editor").Editor
.EditType = EXGRIDLib.EditTypeEnum.CheckListType
.AddItem(1,"One")
.AddItem(2,"Two")
End With
With .Columns.Add("Check")
With .Editor
.EditType = EXGRIDLib.EditTypeEnum.CheckValueType
.Option(EXGRIDLib.EditorOptionEnum.exCheckValue1) = 2
End With
End With
With .Items
.CellValue(.AddItem(1),1) = 0
.CellValue(.AddItem(2),1) = 1
End With
.EndUpdate()
End With
|
921
|
How do I set a locked check-box
![](images/exgridq921.png)
With AxGrid1
.BeginUpdate()
With .Columns.Add("Locked-Check")
With .Editor
.EditType = EXGRIDLib.EditTypeEnum.CheckValueType
.Option(EXGRIDLib.EditorOptionEnum.exCheckValue1) = 2
.Locked = True
End With
End With
With .Columns.Add("Unlocked-Check")
With .Editor
.EditType = EXGRIDLib.EditTypeEnum.CheckValueType
.Option(EXGRIDLib.EditorOptionEnum.exCheckValue2) = 1
End With
End With
With .Items
.CellValue(.AddItem(1),1) = 0
.CellValue(.AddItem(0),1) = 1
End With
.EndUpdate()
End With
|
920
|
Does the title of the cell's tooltip supports HTML format
![](images/exgridq920.png)
With AxGrid1
.BeginUpdate()
With .Columns.Add("")
.Caption = ""
.HTMLCaption = "Column"
End With
With .Items
.CellToolTip(.AddItem("tooltip w/h different title"),0) = "<c><b><fgcolor=FF0000>Title</fgcolor></b><br>This is bit of text that's shown when the user hovers the cell. This shows the tit" & _
"le centered with a different color."
End With
.EndUpdate()
End With
|
919
|
How do I specify a different title for the cell's tooltip
![](images/exgridq919.png)
With AxGrid1
.BeginUpdate()
With .Columns.Add("")
.Caption = "This is the title"
.HTMLCaption = "Column"
End With
With .Items
.CellToolTip(.AddItem("tooltip w/h different title"),0) = "This is bit of text that's shown when the user hovers the cell."
End With
.EndUpdate()
End With
|
918
|
The cell's tooltip displays the column's caption in its title. How can I get ride of that
![](images/exgridq918.png)
Dim h
With AxGrid1
.BeginUpdate()
With .Columns
.Add("C1")
.Add("C2")
End With
With .Items
h = .AddItem("tooltip w/h caption")
.CellToolTip(h,0) = "This is bit of text that's shown when the user hovers the cell. This shows the column's caption in the title."
.CellValue(h,1) = "tooltip no caption"
.CellToolTip(h,1) = "This is bit of text that's shown when the user hovers the cell. This shows no column's caption in the title."
End With
With .Columns.Item("C2")
.HTMLCaption = .Caption
.Caption = ""
End With
.EndUpdate()
End With
|
917
|
How can I programmatically show the column's filter
![](images/exgridq917.png)
' RClick event - Fired when right mouse button is clicked
Private Sub AxGrid1_RClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxGrid1.RClick
Dim c,hit,i
With AxGrid1
i = .get_ItemFromPoint(-1,-1,c,hit)
.Columns.Item(c).ShowFilter("-1,-1,128,128")
End With
End Sub
With AxGrid1
.BeginUpdate()
.ShowFocusRect = False
With .Columns.Add("Items ")
.DisplayFilterPattern = False
.FilterList = EXGRIDLib.FilterListEnum.exShowExclude Or EXGRIDLib.FilterListEnum.exShowFocusItem Or EXGRIDLib.FilterListEnum.exShowCheckBox
End With
With .Items
.AddItem("Item 1")
.AddItem("Item 2")
.AddItem("Item 3")
End With
.EndUpdate()
End With
|
916
|
I want to be able to click on one of the headers, and sort by other column. How can I do that (method 2)
![](images/exgridq916.png)
' ColumnClick event - Fired after the user clicks on column's header.
Private Sub AxGrid1_ColumnClick(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_ColumnClickEvent) Handles AxGrid1.ColumnClick
' Column.SortOrder = 1
With AxGrid1
.SortOnClick = EXGRIDLib.SortOnClickEnum.exDefaultSort
.Columns.Item("Sort").SortOrder = EXGRIDLib.SortOrderEnum.SortAscending
.SortOnClick = EXGRIDLib.SortOnClickEnum.exUserSort
End With
End Sub
With AxGrid1
.BeginUpdate()
.SortOnClick = EXGRIDLib.SortOnClickEnum.exUserSort
.Columns.Add("Items")
.Columns.Add("Sort").Visible = False
With .Items
.CellValue(.AddItem("Item 1 (3)"),1) = 3
.CellValue(.AddItem("Item 2 (1)"),1) = 1
.CellValue(.AddItem("Item 3 (2)"),1) = 2
End With
.EndUpdate()
End With
|
915
|
I want to be able to click on one of the headers, and sort by other column. How can I do that (method 1)
![](images/exgridq915.png)
' ColumnClick event - Fired after the user clicks on column's header.
Private Sub AxGrid1_ColumnClick(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_ColumnClickEvent) Handles AxGrid1.ColumnClick
' Column.SortOrder = 1
With AxGrid1
.Items.SortChildren(0,"Sort",True)
End With
End Sub
With AxGrid1
.BeginUpdate()
.SortOnClick = EXGRIDLib.SortOnClickEnum.exUserSort
.Columns.Add("Items")
.Columns.Add("Sort").Visible = False
With .Items
.CellValue(.AddItem("Item 1 (3)"),1) = 3
.CellValue(.AddItem("Item 2 (1)"),1) = 1
.CellValue(.AddItem("Item 3 (2)"),1) = 2
End With
.EndUpdate()
End With
|
914
|
How can I highlight the cell's button with a different appearance, when cursor hovers it
![](images/exgridq914.png)
With AxGrid1
.BeginUpdate()
.VisualAppearance.Add(1,"c:\exontrol\images\normal.ebn")
.DefaultItemHeight = 22
.TreeColumnIndex = -1
.SelForeColor = RGB(0,0,0)
.SelBackColor = .BackColor
.set_Background(EXGRIDLib.BackgroundPartEnum.exCursorHoverCellButton,16777216)
With .Columns.Add("Buttons")
.Def(EXGRIDLib.DefColumnEnum.exCellHasButton) = True
.Def(EXGRIDLib.DefColumnEnum.exCellValueFormat) = 1
.Alignment = EXGRIDLib.AlignmentEnum.CenterAlignment
.HeaderAlignment = EXGRIDLib.AlignmentEnum.CenterAlignment
End With
With .Items
.AddItem("Button <b>1</b>")
.AddItem("Button <b>2</b>")
.AddItem("Button <b>3</b>")
End With
.EndUpdate()
End With
|
913
|
How can I prevent highlighting the cell's button while cursor hovers it
![](images/exgridq913.png)
' AddItem event - Occurs after a new Item has been inserted to Items collection.
Private Sub AxGrid1_AddItem(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_AddItemEvent) Handles AxGrid1.AddItem
With AxGrid1
With .Items
.CellValue(e.item,0) = "Button <b>A</b>"
.CellValue(e.item,1) = "Button <b>B</b>"
End With
End With
End Sub
With AxGrid1
.BeginUpdate()
.DefaultItemHeight = 22
.TreeColumnIndex = -1
.SelForeColor = RGB(0,0,0)
.SelBackColor = .BackColor
.set_Background(EXGRIDLib.BackgroundPartEnum.exCursorHoverCellButton,-1)
With .Columns.Add("A")
.Def(EXGRIDLib.DefColumnEnum.exCellHasButton) = True
.Def(EXGRIDLib.DefColumnEnum.exCellValueFormat) = 1
.Alignment = EXGRIDLib.AlignmentEnum.CenterAlignment
.HeaderAlignment = EXGRIDLib.AlignmentEnum.CenterAlignment
End With
With .Columns.Add("B")
.Def(EXGRIDLib.DefColumnEnum.exCellHasButton) = True
.Def(EXGRIDLib.DefColumnEnum.exCellValueFormat) = 1
.Alignment = EXGRIDLib.AlignmentEnum.CenterAlignment
.HeaderAlignment = EXGRIDLib.AlignmentEnum.CenterAlignment
End With
.Columns.Add("").Position = 1
With .Items
.CellEnabled(.AddItem(""),1) = False
.AddItem("")
.AddItem("")
End With
.EndUpdate()
End With
|
912
|
How can I change the image of the icon while performing OLE Drag and Drop
![](images/exgridq912.png)
' OLEStartDrag event - Occurs when the OLEDrag method is called.
Private Sub AxGrid1_OLEStartDrag(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_OLEStartDragEvent) Handles AxGrid1.OLEStartDrag
' Data.SetData("your data to drag")
With AxGrid1
e.allowedEffects = 2
End With
End Sub
With AxGrid1
.BeginUpdate()
.OLEDropMode = EXGRIDLib.exOLEDropModeEnum.exOLEDropManual
.ColumnAutoResize = False
.DefaultItemHeight = 22
.HeaderHeight = .DefaultItemHeight
.Columns.Add("Default").Width = 128
With .Items
.AddItem("Item 1")
.AddItem("Item 2")
.AddItem("Item 3")
.AddItem("Item 4")
.AddItem("Item 5")
End With
With .VisualAppearance
.Add(1,"gBFLBCJwBAEHhEJAAChABakMACAADACAxRDQNABQKAAzQFAYaBiG6GAAGEaRYgmFgAQhFcZQSKUOQTDKMIziYBYfgkMIgSbJUgDGAkRRdDSOYDmGQYDiCIoRShOMIjH" & _
"LUXxtDaIZwhEAoJb+RgAUY/cTzaAEUwHHiTKInaCQIhsC4JUJAdRURQ9EwvCIZBpEWwLChENQwWLCNj2TScBwjCyqbale45ViqdoDU8lORLUi+M4zSBPcZVTRtGShPDB" & _
"KTjMLaYgkIIlVpRNa0PC1GTzQ6mazkKQLRADDIDVbAeL3LiMBy9LyLLItQALByua5mWhbcZyBCOPgBTrRb5zO58FjuTK7YLjMB7NrUNYtFaUMy2OpOCADIaecTNcaWLx" & _
"PF2MY1HWYxVj2Jw3DuRJonKYB5lKAYkkYdA6hyDIjBkApaFoAAhBMfYxiGNAkFECZnm4YQBgiOgDl2URSE4KAEj2AJKigFgGgGYIIAyPQ6CCRogAAOxhAMSgSDgIRDhY" & _
"FoFmGCBmBQOAMjgdgQDsUITEIIg5iISAEmIOBigiJgqgqYhoFyVILyyMgyDmYxDg4rBjgiZg6g0Dh4kiTIMGMKAwmgOQkEkFhGhGZIJAoPoQAyQ4mE6BhlAkRgXhODoZ" & _
"C0A4Pg6KRmCSFplkkdheDmJYTioVgACOY4uGaDwmgmJhqg8JlWmOGRmGkChyhyZxJAobYbmMI4yHqFQnkmdh+2RYp4DMIZ5gaBohmiCYGB+IJOmoNhtiPXZGG2I1tgyb" & _
"4lmgGhmhqJt0Fyb4gk8CtsCiahKhYH4oXiAohiUKpKjaLt+goDJxiyaZqlaNot4OTJx3gKp2iiL5sAsBoov+KgMnOMZrisJpKjLjocnPeBLEaRI0m0SxWkSNBPEoDJ1j" & _
"abJrHaXo35obOZC2OximaOZugsYpi3ga42mKO5vAuRpijsTxqAyd49m8S5mnqPuqFyd4gk+DAGn6QJwEwFp+kAT+BnmQpwgwNwOkPtYsnnrgsFcEpFnGDBnBKRRPiwUw" & _
"ckecgMgcIpHGMKQwnuSZygyJ1/HKOgMnyS5zAyRwykycw5g4Eg0jCA57DqTpzkydw+kIDR9AUCY9A2HQXBIUh0g0JRJ5aUxmnQZIPnkUgvDUI5tFcVoPjUOB+A4QBAIC" & _
"A")
.Add(2,"gBFLBCJwBAEHhEJAAChABC8MACAADACAxRDQNABQKAAzQFAYaBiG6GAAGEaRYgmFgAQhFcZQSKUOQTDKMIziaQIRDINQlSTJcQjKKEUQTFiXIyAKKwEgmEQMQiCcbzX" & _
"IUBxAAqXZZFUaKAgOMJDTLBAzUTCQbR7HiQYyBeCQOo+VoaSACEIlAZJRjoOo5DJGGQILlQJqyYrpaAxIgkEJuTqGoQaXgle53PJeLpXW5Nez9P7AMBwK7bbaqeTyXa+" & _
"eDtJhif4cXjIMhyLI8UxXEKOL7jDSYPgqK48QhCEJQPQ9EyXJqnahoemCeRXBZ+aqxbBsCwCep0YBeNr3HaNaz3PK/brtWxMDpeA5IYhhF7WdZFR4tMrOdAtHL9FyPJ5" & _
"TFicgXnoTAKAsRpHPeVhrAUd4LkmY5yj+fQ+i8L4zk+Y5vjCe4oD6ZoNhSRxiisVRKg+T5vnWfB6h6J5yAIf4fieWJFHyHZHHSTAygyAociMKBKEKBIeCiCZyHYFAnCA" & _
"B4mBeBQJlgRIegOCgYCySAgh2WAkgINAMmMNIgCcCYoGYLoLmKaIshqCgMliEICgmDRDEiUQmkmAhWDCD5inicIVg4TQYloJg2g2ExYhoJZJEidIThMCQSFyEwkGKaRK" & _
"FEJQJBkOhLCUJIDFoRiKBmBJhDeDZZDoPAlgmQhghaGZimmHhphqZopDoYw3GYEgFgGHROGOFJkCSSQCDoTAkiSaQ6C6IBJFkPIUCSJ5CDoeQ5CcVZ5gWHROmONJsCMS" & _
"ISByEFyjIRoYiaKYaG6HonEiOhcguJQIHoRJsh0WBWB2JIpiqShKi0OwqnqRouiyTpGhGBxiYIZKOhqGp2j4aRaAqZL3FAECAgA==")
End With
.set_Background(EXGRIDLib.BackgroundPartEnum.exDragDropBefore,16777216)
.set_Background(EXGRIDLib.BackgroundPartEnum.exDragDropAfter,33554432)
.set_Background(EXGRIDLib.BackgroundPartEnum.exDragDropForeColor,65536)
.EndUpdate()
End With
|
911
|
How can I sort by two-columns, one by date and one by time
![](images/exgridq911.png)
Dim h
With AxGrid1
.BeginUpdate()
.SingleSort = False
With .Columns
.Add("Index").FormatColumn = "1 index ``"
.Add("Date").SortType = EXGRIDLib.SortTypeEnum.SortDate
With .Add("Time")
.SortType = EXGRIDLib.SortTypeEnum.SortTime
.FormatColumn = "time(value)"
End With
End With
With .Items
h = .AddItem(0)
.CellValue(h,1) = #1/1/2001#
.CellValue(h,2) = #1/1/2001 10:00:00 AM#
h = .AddItem(0)
.CellValue(h,1) = #12/31/2000#
.CellValue(h,2) = #1/1/2001 10:00:00 AM#
h = .AddItem(0)
.CellValue(h,1) = #1/1/2001#
.CellValue(h,2) = #1/1/2001 6:00:00 AM#
h = .AddItem(0)
.CellValue(h,1) = #12/31/2000#
.CellValue(h,2) = #1/1/2001 8:00:00 AM#
h = .AddItem(0)
.CellValue(h,1) = #1/1/2001#
.CellValue(h,2) = #1/1/2001 8:00:00 AM#
h = .AddItem(0)
.CellValue(h,1) = #12/31/2000#
.CellValue(h,2) = #1/1/2001 6:00:00 AM#
End With
.Layout = "multiplesort=""C1:1 C2:1"""
.EndUpdate()
End With
|
910
|
How can I display a context menu
![](images/exgridq910.png)
' MouseUp event - Occurs when the user releases a mouse button.
Private Sub AxGrid1_MouseUpEvent(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_MouseUpEvent) Handles AxGrid1.MouseUpEvent
With AxGrid1
With CreateObject("Exontrol.ContextMenu")
.Items.ToString = "Check[chk],[sep],Item 1,Item 2,Item 3"
Debug.Print( .Select() )
End With
End With
End Sub
Dim rs
With AxGrid1
.ColumnAutoResize = False
.ScrollBySingleLine = True
.ContinueColumnScroll = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.ReadOnly = EXGRIDLib.ReadOnlyEnum.exReadOnly
End With
|
909
|
Also, are there any plans on the ability to put borders on individual cells or rows or columns
![](images/exgridq909.png)
Dim h,hx
With AxGrid1
.BeginUpdate()
With .VisualAppearance
.Add(1,"gBFLBCJwBAEHhEJAAChABOUGACAADACAxRDQNABQKAAzQFAYbBkGqGAAGIYxYgmFgAQhFcZQSpEEg7BKMYwjOJgFgmEQxDANIBQSKoaQiGQYRhkEYgEiONoaDJCM4wH" & _
"IMQxHCKTZRkGYpajOPobUbGUywHRcRRvH6EZQGWg6GjqK43SCEEZhJBNGyTJ6BZbGURbCqSLAwWZAYy2RCMRxDJqLKypSwKPoGKosS5OUwzHItaRtHaJJAwKZ6ApGQpR" & _
"VTAYxVfC1PzkACma4nS7oXraVJFVZTdYwTh+JABTzGLpnKw7FhGa5pABpdq0RTuOZdAbPMoyXBrXqqB46UCOGg5HRWWwHR7ZIquap9JzfCq5cRbWr5BBOPaBYKwdD1CB" & _
"+iMVRnlQRY4hafZwAMH5Pl4XQnjCEBECSIBpDGHQOicIwtBIBpmiWEIJj6eJQloEgomafgyGGCI6kKYZQH+igGAKAJgEgFgGgGYIFlCf4CmCSA2A6A5hAgRgEgQYRIFY" & _
"FIEmEaBmBmBghigdgQgcIZogYC4ICIKB6CSCRhiiHgogWIooi4F4AmKaIaDCDBihiTg0gsIIYmYOoOmOSJ2D6AZQBAgI=")
.Add(2,"gBFLBCJwBAEHhEJAAChABdUIQAAYAQGKIaBoAKBQAGaAoDDYMg1QwAAxDGLEEwsACEIrjKCVIgkHYJRjGEZxNCMIhiGAaQChEZYHgkMomDAOEgyHKcEgJGyEQgkOa4a" & _
"jCKYrSzAcrwTI4cRVHiQZygOZ4DBSOY8VBAcQweItJhrKqVRgriitNQjCyjZCpOaIDooAJmRZNNISBBIEQSKA0TDOQ5TSKUMYhOZTBBEbbMNBtBIUIRpajbMBiFywUxU" & _
"OJYXhmG4dR7IMhyLI8UxXFo7P7mOZZXjmO49T7Kc70LQ9CyHJKnabpWoaXj2VZZV7Mda2DTNSzPKK1bZpG4bTouKZ5WjfN72fgeCzrF7HchyPJcXxnG4ZAMBA")
.Add(3,"gBFLBCJwBAEHhEJAAChABL0GACAADACAxRDQNABQKAAzQFAYbBkGqGAAGIYxYgmFgAQhFcZQSpEEg7BKMYwjOJgEgmEQxDANIBQSKoaQiGQYRhkEYpFiONoXDJCM4wH" & _
"IMQxHCKTZRkGYpajOPobUbGUygBRdExvEyEZQGWg6GjqK43SCEEZhJBNGyfH6dBpEWT7ChENQwWLLFoRDIcQyXCytIDter4boGKosS5OUwzGAtaRvHaJJAwKZ6ApGQpR" & _
"VTAYxUdC1HTjJiEa4nS7oXraVJFVZTdYwTh+JABTzGKbsSycKqWaqkABZeoWbTuOZdAbPMoyXBrXgOLYzUCOGg5HRWWwHR7ZIq0Pg9Hqaa4bVbIVxbcAGH6BQa6J5hEB" & _
"ECSIBpDGHQOicIwtBIBpmhqEIJj2eJQloEgokiegyGGCI6kKZ5BnefA+D8L4flOa52nufg+g+f5fnPFB/ooBZ1omSAWASAJgGgJgJgIIIoDYAIDCCaBFnuBAhCgOgUgU" & _
"YIoF4GIBiGKBuAcfohmgNgdggX54g4JB/F+GImCqCpikiNguguUAQICA=")
.Add(4,"gBFLBCJwBAEHhEJAAChABBUGACAADACAxRDQNABQKAAzQFAYbBkGqGAAGIYxYgmFgAQhFcZQSpEEg7BKMYwjOJgCgmEQxDANMiwGKoaQiGQYRhkEYgFiONoaDJCM4wH" & _
"IMQxHCKTZRkGYpajOPobUbAYQQSAkEgpECbZqoEZaDoaOorTZINJ0VR1Ox5KKfZyGURZPqOEQ1DBZEI2RZUbxDJquLhACj7AjeZZtRJZVp2TY9eQ3LC3aYhGqwAwSFpJ" & _
"VjUEBgRBJIDSMY6DpOIxaEgNZpwEITOTxUK0EhRLy5agDCJ1QrCdanahqOpaXpmW5dV7YNh2LTnfzXNq3bhuO5bXqOd59X7fN54Dg+D4LRLHbpxXIcXqvFaZZDnOb4To" & _
"PEuAZUmqcB2B2DoHGuN5Tm6d46lsPwfhOS5mnOeg9DqCAIICA")
End With
.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exGroupLinesAtRoot
.SelBackColor = .BackColor
.SelForeColor = .ForeColor
.DefaultItemHeight = 22
.Columns.Add("")
.Columns.Add("").Def(EXGRIDLib.DefColumnEnum.exCellBackColor) = 33554432
.Columns.Add("")
With .Items
h = .AddItem("Root 1")
.ItemBackColor(h) = &H1000000
hx = .SplitCell(h,0)
.CellValue(0,hx) = "count(current,dir,1)"
.CellValueFormat(0,hx) = EXGRIDLib.ValueFormatEnum.exTotalField
.FormatCell(0,hx) = "'Childs: ' + value"
.CellBackColor(0,hx) = &H3000000
.CellHAlignment(0,hx) = EXGRIDLib.AlignmentEnum.CenterAlignment
.InsertItem(h,Nothing,"Child 1")
.InsertItem(h,Nothing,"Child 2")
.ExpandItem(h) = True
h = .AddItem("Root 2")
.ItemBackColor(h) = &H4000000
hx = .SplitCell(h,0)
.CellValue(0,hx) = "count(current,dir,1)"
.CellValueFormat(0,hx) = EXGRIDLib.ValueFormatEnum.exTotalField
.FormatCell(0,hx) = "'Childs: ' + value"
.CellBackColor(0,hx) = &H3000000
.CellHAlignment(0,hx) = EXGRIDLib.AlignmentEnum.CenterAlignment
.InsertItem(h,Nothing,"Child 1")
.InsertItem(h,Nothing,"Child 2")
.InsertItem(h,Nothing,"Child 3")
.ItemBackColor(.InsertItem(h,Nothing,"Child 4")) = &H4000000
End With
.EndUpdate()
End With
|
908
|
How can I decode the Layout property
With AxGrid1
.BeginUpdate()
With .Columns
.Add("C1")
.Add("C2").Position = 1
End With
With .Items
.CellValue(.AddItem("SubItem 1.1"),1) = "SubItem 1.2"
.CellValue(.AddItem("SubItem 2.1"),1) = "SubItem 2.2"
End With
.Columns.Item("C2").SortOrder = EXGRIDLib.SortOrderEnum.SortDescending
.EndUpdate()
Debug.Print( "Encoded:" )
Debug.Print( .Layout )
With CreateObject("Exontrol.Print")
Debug.Print( "Decoded: " )
Debug.Print( .Decode64TextW(AxGrid1.Layout) )
End With
End With
|
907
|
No new line is shown if using <br> tag. How can I show a new line with-in the cell
![](images/exgridq907.png)
Dim h
With AxGrid1
.BeginUpdate()
.ScrollBySingleLine = True
.DrawGridLines = EXGRIDLib.GridLinesEnum.exRowLines
With .Columns.Add("Single-Line")
.Def(EXGRIDLib.DefColumnEnum.exCellSingleLine) = True
.Def(EXGRIDLib.DefColumnEnum.exCellValueFormat) = 1
End With
With .Columns.Add("Multiple-Lines")
.Def(EXGRIDLib.DefColumnEnum.exCellSingleLine) = False
.Def(EXGRIDLib.DefColumnEnum.exCellValueFormat) = 1
End With
With .Items
.CellValue(.AddItem("First-Line<br>Second-Line"),1) = "First-Line<br>Second-Line"
h = .AddItem("First-Line<br>Second-Line<br>Third-Line")
.CellSingleLine(h) = EXGRIDLib.CellSingleLineEnum.exCaptionWordWrap
.CellHAlignment(h,0) = EXGRIDLib.AlignmentEnum.CenterAlignment
.ItemDivider(h) = 0
End With
.EndUpdate()
End With
|
906
|
I am using exCRD to layout the columns in the grid, but is there a way where I can have the text in a cell wrap if it's exceeds the width of the cell instead of showing the ...'s
![](images/exgridq906.png)
Dim h
With AxGrid1
.BeginUpdate()
.DrawGridLines = EXGRIDLib.GridLinesEnum.exRowLines
.DefaultItemHeight = 36
.FullRowSelect = EXGRIDLib.CellSelectEnum.exColumnSel
With .Columns
With .Add("Column1")
.Visible = False
.Editor.EditType = EXGRIDLib.EditTypeEnum.EditType
End With
With .Add("Column2")
.Visible = False
.Editor.EditType = EXGRIDLib.EditTypeEnum.EditType
End With
With .Add("Column3")
.Visible = False
.Def(EXGRIDLib.DefColumnEnum.exCellSingleLine) = False
.Editor.EditType = EXGRIDLib.EditTypeEnum.EditType
End With
With .Add("Column4")
.Alignment = EXGRIDLib.AlignmentEnum.CenterAlignment
.HeaderAlignment = EXGRIDLib.AlignmentEnum.CenterAlignment
.Visible = False
.Def(EXGRIDLib.DefColumnEnum.exCellHasButton) = True
.Def(EXGRIDLib.DefColumnEnum.exCellButtonAutoWidth) = True
End With
With .Add("FormatLevel")
.FormatLevel = "(0/1),""Information to be shown on the control's header""[a=17][ww]:128,3:128"
.Def(EXGRIDLib.DefColumnEnum.exCellFormatLevel) = "(0/1),2[a=17][ww]:128,3:128"
End With
End With
With .Items
h = .AddItem("Cell 1.1")
.CellValue(h,1) = "Cell 1.2"
.CellValue(h,2) = "This is just a bit of information on first row"
.CellValue(h,3) = "Cell 1.4"
.CellSingleLine(h,3) = EXGRIDLib.CellSingleLineEnum.exCaptionWordWrap
h = .AddItem("Cell 2.1")
.CellValue(h,1) = "Cell 2.2"
.CellValue(h,2) = "This is just a bit of information on second row"
.CellValue(h,3) = "Cell 2.4"
End With
.EndUpdate()
End With
|
905
|
How can I load pictures using URL ( http:// )
Dim http
With AxGrid1
http = CreateObject("Exontrol.HTTP")
.PictureDisplay = EXGRIDLib.PictureDisplayEnum.LowerRight
.Picture = http.GETImage("http://mail.exontrol.com/images/exontrol.png")
End With
|
904
|
How can I filter programmatically by multiple columns
Dim h
With AxGrid1
.BeginUpdate()
With .Columns
.Add("Name")
With .Add("Active")
.Def(EXGRIDLib.DefColumnEnum.exCellHasCheckBox) = True
.DisplayFilterButton = True
End With
.Add("Type")
.Add("Mode").FilterType = EXGRIDLib.FilterTypeEnum.exFilter
End With
With .Items
h = .AddItem("Item A")
.CellState(h,1) = 1
.CellValue(h,2) = "A"
h = .AddItem("Item B")
.CellState(h,1) = 0
.CellValue(h,2) = "B"
h = .AddItem("Item C")
.CellState(h,1) = 1
.CellValue(h,2) = "C"
.CellValue(h,3) = "None"
h = .AddItem("Item D")
.CellState(h,1) = 1
.CellValue(h,2) = "C"
End With
With .Columns.Item(1)
.FilterType = EXGRIDLib.FilterTypeEnum.exCheck
.Filter = 1
End With
With .Columns.Item(2)
.FilterType = EXGRIDLib.FilterTypeEnum.exFilter
.Filter = "C"
End With
With .Columns.Item(3)
.FilterType = EXGRIDLib.FilterTypeEnum.exNonBlanks
End With
.ApplyFilter()
.EndUpdate()
End With
|
903
|
How can I add Right-To-Left Reading-Order / RTL Layout
With AxGrid1
.BeginUpdate()
.TreeColumnIndex = -1
With .Columns.Add("RTL - Header Caption")
.HeaderAlignment = &H20000 Or EXGRIDLib.AlignmentEnum.RightAlignment
.Alignment = &H20000 Or EXGRIDLib.AlignmentEnum.RightAlignment
End With
.FullRowSelect = EXGRIDLib.CellSelectEnum.exColumnSel
With .Items
.AddItem("RTL - Text Right")
.CellHAlignment(.AddItem("RTL - Text Center"),0) = &H20000 Or EXGRIDLib.AlignmentEnum.CenterAlignment
.CellHAlignment(.AddItem("RTL - Text Left"),0) = &H20000
End With
.EndUpdate()
End With
|
902
|
I have applied ebn to the grid using the following code, and noticed that it applies to the filter dropdownList too. Is there a way to prevent this behavior, like keeping the Filter dropdownlist intact
![](images/exgridq902.png)
With AxGrid1
.VisualAppearance.Add(1,"c:\exontrol\images\normal.ebn")
.Appearance = &H1000000
.GetOcx().BackColorHeader = &H1000000
.set_Background(EXGRIDLib.BackgroundPartEnum.exBackColorFilter,-2147483633)
.Columns.Add("Filter").DisplayFilterButton = True
With .Items
.AddItem("Item 1")
.AddItem("Item 2")
End With
End With
|
901
|
The tree lines from the group parent to its children are missing and no identation is present: the parent and all its children are on the same offset from left. What canbe done
![](images/exgridq901.png)
' AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection.
Private Sub AxGrid1_AddGroupItem(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_AddGroupItemEvent) Handles AxGrid1.AddGroupItem
Dim nGroupColumn
With AxGrid1
With .Items
nGroupColumn = .GroupItem(e.item)
.ItemDivider(e.item) = -1
.FormatCell(e.item,0) = .FormatCell(e.item,nGroupColumn)
.CellValue(e.item,0) = AxGrid1.Columns.Item(nGroupColumn).GroupByTotalField
.CellValueFormat(e.item,0) = .CellValueFormat(e.item,nGroupColumn)
End With
End With
End Sub
Dim rs
With AxGrid1
.BeginUpdate()
.ReadOnly = EXGRIDLib.ReadOnlyEnum.exReadOnly
.ColumnAutoResize = False
rs = CreateObject("ADOR.Recordset")
With rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
End With
.DataSource = rs
.SortBarVisible = True
.SortBarCaption = "Drag a <b>column</b> header here to group by that column."
.AllowGroupBy = True
With .Columns.Item(0)
.AllowGroupBy = False
.Width = 96
End With
.Columns.Item(1).SortOrder = EXGRIDLib.SortOrderEnum.SortAscending
.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exLinesAtRoot
.EndUpdate()
End With
|